Waits until the specified window exists.

WinWait , WinTitle, WinText, Timeout, ExcludeTitle, ExcludeText


WinTitle, WinText, ExcludeTitle, ExcludeText

At least one of these is required. Specify for WinTitle a window title or other criteria to identify the target window and/or for WinText a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText has been turned on. Windows whose title or text contains ExcludeTitle or ExcludeText will not be considered.


If blank or omitted, the command will wait indefinitely. Otherwise, it will wait no longer than this many seconds. To wait for a fraction of a second, specify a floating-point number, for example, 0.25 to wait for a maximum of 250 milliseconds. Specifying 0 is the same as specifying 0.5. This parameter can be an expression.


ErrorLevel is set to 1 if the command timed out or 0 otherwise.


If a matching window comes into existence, the command will not wait for Timeout to expire. Instead, it will immediately set ErrorLevel to 0, update the Last Found Window, and the script will continue executing.

While the command is in a waiting state, new threads can be launched via hotkey, custom menu item, or timer.

If another thread changes the contents of any variable(s) that were used for this command's parameters, the command will not see the change -- it will continue to use the title and text that were originally present in the variables when the command first started waiting.

Unlike WinWaitActive, the Last Found Window cannot be used. Therefore, at least one of the window parameters (WinTitle, WinText, ExcludeTitle, ExcludeText) must be non-blank.

Window titles and text are case-sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.

WinWaitActive, WinWaitClose, WinExist(), WinActive(), Process, SetTitleMatchMode, DetectHiddenWindows


Opens Notepad and waits a maximum of 3 seconds until it exists. If WinWait times out, an error message is shown, otherwise Notepad is minimized.

Run, notepad.exe
WinWait, Untitled - Notepad,, 3
if ErrorLevel
    MsgBox, WinWait timed out.
    WinMinimize ; Use the window found by WinWait.