Method Reference (COM)

WinWait

Pauses execution of the script until the requested window exists.

WinWait "title" [, "text" [, timeout]]

 

Parameters

title The title of the window to check.
text [optional] The text of the window to check.
timeout [optional] Timeout in seconds

 

Return Value

Success: Returns 1.
Failure: Returns 0 if timeout occurred.

 

Remarks

The script polls for window match every 250 milliseconds or so.

 

Related

WinActive, WinExists, WinWait, WinWaitActive, WinWaitClose, WinWaitNotActive, WinWaitDelay (Option)

 

Example

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

'Wait for the window "Untitled" to exist

oAutoIt.Run "notepad.exe"
oAutoIt.WinWait "Untitled"

'Wait a maximum of 5 seconds for "Untitled" to exist
oAutoIt.WinWait "Untitled", "", 5