Top  Previous  Next

Sub Wsw_MergePages(Handle, sMemWeb, nPageNumber, sUrl, ByRef sNewUrl, ByRef sNewPostData, ByRef bChangeBookmarkUrl, ByRef sStatusMessage, ByRef iStatusCode)


This function is called during a bookmark check and offers a way to merge different pages to a single page.




Handle ... Bookmark handle.
sMemWeb ... String expression. HTML source code of the last checked page. All links are available as absolute URLs.
nPageNumber ... Integer value. Amount of checked pages, value starts with 1. Helps to limit the number of merged pages. WebSite-Watcher can merge maximal 10 pages.
sUrl ... String expression. URL of the last checked page.
sNewUrl ... String expression. Return value, that contains the new URL that should be checked and merged with the previously checked page. Initial value is an empty string. If an empty string is returned, then the merge operations will be terminated.
sNewPostData ... String expression. Return value, that contains PostData if the page should be checked via the POST command. If that parameter is empty, then the page will be checked with the GET command. Default value is an empty string.
bChangeBookmarkUrl ... Boolean value. Return value, default value is FALSE. Set this variable to TRUE if the bookmark URL should replaced with the returned parameter sNewUrl. This is only useful if you monitor a forum thread and always want to read the latest posts/pages, then the bookmark URL is always updated to the last checked page. If you monitor a search result, then simply don't assign a value to that parameter.
sStatusMessage ... String expression. Status message that will be displayed in the status column. Default value is an empty string.
iStatusCode ... Integer value. Returns the success status of that function.


Valid values of iStatusCode:

0 ...

OK, event function could be processed successfully.

Default value, must not be assigned manually.

1 ...


Should be returned if errors are detected, the bookmark check will be aborted.



Sub Wsw_MergePages(Handle, sMemWeb, nPageNumber, sUrl, ByRef sNewUrl, ByRef sNewPostData, ByRef bChangeBookmarkUrl, ByRef sStatusMessage, ByRef iStatusCode)


   Dim nPageParamNumber, sPageParam, sNewPageParam


   ' Limit the number of merged pages

   If nPageNumber > 3 Then


   End If


   ' Extract page number

   sPageParam = GetFirstRegexMatch(sUrl, "\&start=\d+")

   If sPageParam = "" Then

      ' first page, continue with page 2 (solved with start=10)

      sNewPageParam = "&start=10"

      sUrl = sUrl + sNewPageParam


      ' increase page number

      nPageParamNumber = CInt(ExtractDigits(sPageParam)) + 10

      sNewPageParam = "&start=" + CStr(nPageParamNumber)

      sUrl = ReplaceText(sUrl, sPageParam, sNewPageParam)

   End If


   ' check (only) via Page-Param, if the next page is already available in the page source

   If Pos(sNewPageParam, sMemWeb) > 0 Then

      ' the next page exists

      sNewUrl = sUrl

      sStatusMessage = "Merge pages via FOLLOW-Plugin"

   End If


End Sub


See also examples Merge search result pages and Merge pages in forum thread.

Translate document: