Waits until the specified window is active or not active.
WinWaitActive WinTitle, WinText, Seconds, ExcludeTitle, ExcludeText WinWaitNotActive WinTitle, WinText, Seconds, ExcludeTitle, ExcludeText
A window title or other criteria identifying the target window. See WinTitle.
If present, this parameter must be 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 is ON.
How many seconds to wait before timing out and setting ErrorLevel to 1. Leave blank to wait indefinitely. Specifying 0 is the same as specifying 0.5.
Windows whose titles include this value will not be considered.
Windows whose text include this value will not be considered.
ErrorLevel is set to 1 if the function timed out or 0 otherwise.
If a matching window satisfies the function's expectation, the function will not wait for Seconds to expire. Instead, it will immediately set ErrorLevel to 0 and the script will continue executing.
Both WinWaitActive and WinWaitNotActive will update the Last Found Window if a qualified window is active when the function begins. In addition, WinWaitActive will update the Last Found Window if a qualified window becomes active before the function times out.
While the function 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 function's parameters, the function will not see the change -- it will continue to use the title and text that were originally present in the variables when the function first started waiting.
Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.
WinWait, WinWaitClose, WinExist, WinActive, SetTitleMatchMode, DetectHiddenWindows
Run "notepad.exe" WinWaitActive "Untitled - Notepad", , 2 if ErrorLevel { MsgBox "WinWait timed out." return } else WinMinimize ; minimize the window found by WinWaitActive.