WaitForWindow Method

Action2 Example

 

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

 

Declaration

function WaitForWindow (varWindowText As Variant,

intExactMatch As Integer,

intIncludeChildren As Integer,

intWaitTime As Integer,

intCheckInterval As Integer,

intNoWindowAction 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.

 

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. To wait an infinite time, set to –1.

 

intCheckInterval

 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.

 

intNoWindowAction

 Specifies what action AutoMate™ should take if intWaitTime expires and the specified window still has not appeared:

  

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 WaitForWindow method pauses AutoMate™ until a window with the specified text appears.

 

Use WaitForWindow to wait for the system to enter a specific state (for example, an error message box appears) before continuing to the next step or next line of code.