Wait for a window to be displayed
See Window synchronization to wait until a specific window is displayed.
See OnAction function to make a specific action every time a window is displayed (Not available in WinTask Lite).
Example
When you download a file from an url, the file download takes a while, and you have to wait for the window which tells Download complete and then click the OK button. The window synchronization wizard (Menu Insert/Synchronization/On Window) can be used to generate this code:
StartBrowser("IE", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'File']")
UseWindow("IEXPLORE.EXE|#32770|File Download",2)
Click(Button,"&Save")
UseWindow("IEXPLORE.EXE|#32770|Save As",2)
Click(Button,"&Save")Pause 600 secs until
WinStatus(Active,Exact)
InWindow("IEXPLORE.EXE|#32770|Download complete",2)
PauseFalse
MsgBox("'Wait for' at line " + #ErrorLine$ + " has failed !")
End
EndPause
UseWindow("IEXPLORE.EXE|#32770|Download complete",2)
Click(Button,"Close")