The WinWaitClose function will, when used, pause the script execution until a given window closes, at which point execution is resumed.
This function can be used in combination with WinExists, to handle situations where you want the script to be paused while a given window is alive.
If a timeout is provided, and the window is not closed within the provided timeout, the script will exit.
Returns 1 on success and 0 if the optional timeout was reached. If no timeout is provided, the function will keep checking in intervals of around 250 millisecond.
|Title||The title of the window.||Required|
|Text||The text of the window to read.||Optional|
|Timeout||Timeout in seconds||Optional|
In the first example below, the script will continuously wait for the window to close. In the second example, it will wait a maximum of 10 seconds, after which the script simply exists, if the window is not closed within the timeout.
; Will wait for "[CLASS:Notepad]" to not exist WinWaitClose("[CLASS:Notepad]")
The following example includes a timeout:
; Will wait a maximum of 10 seconds "[CLASS:Notepad]" to not exist ; After which the script simply exits WinWaitClose("[CLASS:Notepad]", "", 5)