Window Synchronization

A Window synchronization makes the script at execution waits till a specific window appears or disappears.

Window Synchronization dialog can be accessed with the Insert/Synchronization/On Window menu or in Recording mode by clicking in the WinTask toolbar the Synchronization on Window icon.

Field window specifies the window name of the window on which synchronization must be made. Click button Spy in order to call SPY module which finds for your that window name.

If Exact name match is checked, synchronization will happen only if a window with exactly the specified window name is detected. If unchecked, a search for a window with nearly the same window name is made (see Window name). If Ignore instance is checked, synchronization will occur whatever instance number is detected.

Script goes on with its execution when the specified window appears on the top of all the others (Active), disappears (Not active), exists or does not exist (not exists), whatever it is on top of all.

The window synchronization reports a failure at execution if the specified window is not seen within a default timeout of 120 seconds. Check the checkbox Use this timeframe and specify another value if you want to change the default timeout.

On Pause failure, a default message is displayed, click Options button if you want to change the default message. If you uncheck On Pause failure end the script, when the pause fails, execution of the script goes on.

Click Paste into the script (or Insert and Resume) to paste the synchronization statements into the script.

See also

Popup window while running a task

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) has been 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")