Function Reference


WinWait

Pauses execution of the script until the requested window exists.

WinWait ( "title" [, "text" [, timeout = 0]] )

Parameters

title The title/hWnd/class of the window to check. See Title special definition.
text [optional] The text of the window to check. Default is an empty string. See Text special definition.
timeout [optional] Timeout in seconds if the window does not exist. Default is 0 (no timeout).

Return Value

Success: a handle to the requested window.
Failure: 0 if timeout occurred.

Remarks

The window is polled every 250 milliseconds or so.

Related

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

Example

Example()

Func Example()
        ; Run Notepad
        Run("notepad.exe")

        ; Wait 10 seconds for the Notepad window to appear.
        WinWait("[CLASS:Notepad]", "", 10)

        ; Wait for 2 seconds to display the Notepad window.
        Sleep(2000)

        ; Close the Notepad window using the classname of Notepad.
        WinClose("[CLASS:Notepad]")
EndFunc   ;==>Example