CurrentPage$
Web function.
The CurrentPage$ function returns the title of the current Web page.
Usage
Some Web sites have dynamic page titles (the title changes at each display), CurrentPage$ will retrieve the correct page title.
Syntax
page_title$=CurrentPage$()
Return value
page_title$, string. It gives the title of the current Web page as seen by WinTask processing Web pages. So a StartBrowser or a UsePage must be in the script before, or an empty string will be returned.
Remarks
CurrentPage$ returns the current Web page without any synchronization, so the page must have finished to load.
Examples
StartBrowser("IE","www.wintask.com")
'StartBrowser makes the automatic synchronization and waits until the page is loaded
a$=currentpage$()
msgbox(a$)
CloseBrowser()
StartBrowser("FF","www.wintask.com")
'StartBrowser makes the automatic synchronization and waits until the page is loaded
a$=currentpage$()
msgbox(a$)
CloseBrowser()
Error sub-routine returning the non-expected page loaded after a link has been clicked and the page after that click is not the expected one:
sub iferror()
local page$
page$=currentpage$()
'page$ contains the page displayed just before the call to that function.
msgbox(page$)
usepage(page$)
'To come back to a known web page, we click Home in the error Sub
ClickHTMLElement("A[INNERTEXT= 'Home']")endsub
'Use example on www.wintask.com
startbrowser("ie","www.wintask.com")
UsePage("Macro and Data Extraction with WinTask - the automation software for Windows and internet")
'This clickhtmlelement loads a page which makes fail the next OCR synchronization.
ClickHTMLElement("A[INNERTEXT= 'DOWNLOAD your 30-day']")
ret = UseOCREngine(1)
ret=0
Pause 30 until
TextOCR("on the recording ")
InWindow("IEXPLORE.EXE|Internet Explorer_Server||1",1)
PauseOK
ret=1
PauseFalse
ret=0
EndPause
if ret=0 then
'The pause OCR failed if ret=0, so we call the Error Sub to know which page title is currently displayed
iferror()
endif