WaitForWindowToDisappear Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “Flow Control” group, “Wait for a window to disappear.” The method pauses AutoMate™ for a specified period of time or until a window with the specified text disappears.

 

Declaration

function WaitForWindowToDisappear (varWindowTitle As Variant,

intExactMatch As Integer,

intIncludeChildren As Integer,

intWaitInfinite As Integer,

intInterval As Integer,

intWaitTime As Integer,

intStillPresentAction As Integer,

varTaskToStart As Variant) As Integer

 

Parameters

varWindowText

 The title bar text of the window to wait for.

 

intExactMatch

 Specifies whether or not varWindowText must be matched exactly by any appearing window. Set to “1” if varWindowText must be matched exactly or “0” for a substring or partial match.

 

intIncludeChildren

 Set to “1” to check all windows in the system for varWindowText. Set to “0” to just check top level or main application windows.

 

intWaitInfinite

 Specifies whether AutoMate™ should wait an infinite period of time for the window to disappear. Set to “0” to wait an infinite period of time and ignore the intInterval and intWaitTime parameters. Set to “1” to wait for a specific period of time.

 

intInterval

 The number of seconds between times AutoMate™ will enumerate all system windows in search for the wanted window. Setting this to a low value (e.g., 1-second) slightly increases CPU utilization.

 

intWaitTime

 The number of seconds AutoMate™ should wait for the window to appear. If the window does not appear, AutoMate™ checks the intNoWindowAction parameter for what to do.

 

intStillPresentAction

 Specifies what action AutoMate™ should take if intWaitTime expires and the specified window is still present:

  

Value

Meaning

0

Start another task (specified by varTaskToStart)

1

Stop the task (method returns 2)

2

Continue the task (method returns 0)

 

varTaskToStart

 The task AutoMate™ should start if the window does not appear within intWaitTime, and intNoWindowAction is set to “0.”

 

Description

The WaitForWindowToDisappear method pauses AutoMate™ until a window with the specified text disappears.

 

Use WaitForWindowToDisappear to wait for the system to enter a specific state (for example, an application’s main window closes, indicating the end of a program’s run) before continuing to the next step or next line of code.