WinWaitClose

Suspends the WIL program execution until a specified window has been closed.

Syntax:

WinWaitClose (partial-winname [, timeout] )

Parameters:

(s) partial-winname: either an initial portion of, or an entire window name. WinWaitClose suspends execution until all matching windows have been closed.

(i) timeout: [optional] number of seconds to wait for the targeted window to be closed (maximum = 86400). Specify 0 to have the function return immediately. Specify -1 for no timeout (wait forever). The default is -1.

Returns:

(i) @TRUE if at least one window was found to wait for; @FALSE if no windows were found.

 

Use this function to suspend the WIL program's execution until the user has finished using a given window and has manually closed it.

This function works only with top-level (parent) application windows.

If the window doesn’t exist, the function will return immediately and return the value @FALSE. If the window exists, the function will wait for it close or until the timeout period has elapsed, whichever comes first, and then return the value @TRUE.

Note: This function has a built-in ½ second time delay before returning after no longer finding the targeted window. There is no built-in delay if the function never finds the window. The delay time can be modified by the function
IntControl (70, p1, 0, 0, 0)

Example:

Run("notepad.exe", "")
Display(4, "Note", "Close Notepad to continue")
WinWaitClose("~Notepad")
Message("Continuing...", "Notepad closed")

See Also:

AppWaitClose, IntControl 70, TimeDelay, RunWait, WinExist, WinWaitChild, WinWaitExist, Yield, Partial Window Names