Wait for Window Action Icon

Wait for Window

Declaration

<AMWAITFORWINDOW WINDOWTITLE="text" ALLOWHIDDEN="YES/NO" WINDOWHANDLEVARIABLE="text" WINDOWCLASSVARIABLE="text" WINDOWTITLEVARIABLE="text" CONTAINSOBJECT="YES/NO" OBJECTNAME="text" OBJECTVALUE="text" OBJECTCLASS="text" OBJECTTYPE="text" CHECKOBJECTNAME="YES/NO" CHECKOBJECTVALUE="YES/NO" CHECKOBJECTCLASS="YES/NO" CHECKOBJECTTYPE="YES/NO" RESULTDATASET="text" FOCUSWINDOW="YES/NO" />

See Also

Pause Task | Wait for File | Wait for Pixel | Wait for Pointer | Wait for Process | Wait for Window | Stop Timer | Read Timer  | Start Timer

Description

Causes task execution to pause at the current line until the specified window is open, closed, focused, or unfocused.

Practical Usage

Commonly used to wait for the appearance or disappearance of a dialog box or window generated by an external application. This can be used to confirm that a process has completed successfully. For example, if automating a report printing process, you could use the Wait for Window action to wait until the dialog box "Report Complete" appears before performing further processing.  If the window appears, the task continues, and if not, it fails.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Action

Text (options)

Yes

Open

ACTION="close"

Specifies the action to wait for. The available options are:

  • Wait for window to open (default): Wait for the window to be opened.

  • Wait for window to close: Wait for the window to be closed.

  • Wait for window to be focused: Wait for the window to be focused.

  • Wait for the window to not be focused: Wait for the window to be unfocused.

Window Title Must Be

Text

Yes

(Empty)

  1. WINDOWTITLE="Untitled - Notepad"

  2. WINDOWTITLE="*Internet Explorer*"

The title of the window to wait for. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example "*Internet Explorer*" would include all windows containing Internet Explorer.

Window Class Must Be

Text

No

(Empty)

WINDOWCLASS="Outlook Express Browser Class"

The class of the window to wait for. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example "*Explore*" would include all window classes containing Explore.

Window Handle Must Be

Number

No

(Empty)

WINDOWHANDLE="555735"

The handle of the window to wait for. If set to 0 or omitted, this parameter is ignored.

Window is a Child Window

Yes/No

No

No

CHILDWINDOW="YES"

If set to YES, specifies that the window to wait for is a child window. This option is useful for Multi-Document Interface (MDI) applications, which contain a series of windows contained within one parent window. This parameter is set to NO by default.

Focus Found Window

Yes/No

No

No

FOCUSWINDOW="YES"

If set to YES, specifies that the window should be focused when found. This might be used with a Wait for window to open action to ensure that the window is also focused at the end of the step.

Contents Properties

The Contents tab contains standard window dissection parameters used to describe controls or text inside a window. These parameters are documented under Window Dissection Parameters and can be used to define additional window characteristics used to determine a matching window.

To specify additional window characteristics, enable the option Window must contain the object(s), click the Add button and drag the AutoMate icon to the desired window object or control. The "Object Description" segment becomes populated with the characteristics of the selected object. Click the Edit button to access/edit the following properties:

Property

Type

Required

Default

Markup

Description

Object type must be

Yes/No

Yes

Yes

CHECKOBJECTTYPE="YES"

If set to YES, specifies that the value populated in the Object type parameter will be examined when determining a matching object. If set to NO, the Object type parameter is ignored.

Object type (Text-box)

Text

Yes

(Empty)

OBJECTTYPE="PushButton"

The type of object or control that should be examined. This parameter is ignored if the Object type must be parameter is set to NO.

Object class must be

Yes/No

No

No

CHECKOBJECTCLASS="YES"

If set to YES, specifies that the value populated in the Object class parameter will be examined when determining a matching object. If set to NO the Object class parameter is ignored.

Object class (text-box)

Text

No

(Empty)

OBJECTCLASS="SysTreeView32"

The object class that should be examined. This parameter is ignored if the Object class must be parameter is set to NO.

Object name must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the value populated in the Object name parameter will be examined when determining a matching object. If set to NO the Object name parameter is ignored.

Object name (text-box)

Text

No

(Empty)

OBJECTNAME="Cancel"

The object name that should be examined. This parameter is ignored if the Object name must be parameter is set to NO.

Object value must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the value populated in the Object value parameter will be examined when determining a matching object. If set to NO the Object value parameter is ignored.

Object value (text-box)

Text

No

(Empty)

OBJECTVALUE="1"

The object value that should be examined. This parameter is ignored if the Object value must be parameter is set to NO.

Object position must be

Yes/No

No

No

CHECKOBJECTPOSITION="YES"

If set to YES, specifies that the X and Y coordinates will be examined when determining a matching object. If set to NO, the position of the object is ignored.

NOTE: The X and Y coordinates are relative to the Window specified in the Window title must be parameter (not the screen).

Position X

Text

No

(Empty)

OBJECTXPOS="80"

The X coordinate position of the object relative to the window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Position Y

Text

No

(Empty)

OBJECTYPOS="90"

Specifies the Y coordinate position of the control relative to the Window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Advanced Properties

Property

Type

Required

Default

Markup

Description

Include hidden windows

Yes/No

No

No

ALLOWHIDDEN="YES"

If set to YES, specifies that hidden (non-visible) windows should be included in the window search. By default, hidden windows are not searched.

Populate variable with window title

Text

No

(Empty)

WINDOWTITLEVARIABLE=VarName"

If enabled, specifies the name of an already existing variable that should be populated with the title of the window that was closed.

Populate variable with window class

Text

No

(Empty)

WINDOWCLASSVARIABLE="VarName"

If enabled, specifies the name of an already existing variable that should be populated with the class of the window that was closed.

Populate variable with window handle

Text

No

(Empty)

WINDOWHANDLEVARIABLE="VarName"

If enabled, specifies the name of an already existing variable that should be populated with the handle of the window that was closed.

Create and populate dataset

Text

No

(Empty)

RESULTDATASET="DatasetName"

The name of a dataset to be created and populated with window data from the window that was closed. More on the fields that this dataset creates can be found under Notes below.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.Title

Text

Returns the window title of the window.

theDataset.Class

Text

Returns the class of the window.

theDataset.Handle

Number

Returns the handle of the window.

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Window Dissection™ Technology

This action contains a subset of Network Automation's unique "Window Dissection Technology".

More on Window Dissection

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Wait for the window with the title "Google - Windows Internet Explorer" to open.  Focus the window after the wait is over.  Include hidden windows.  Populate the variable "handlevar" with the window's handle.  Populate the variable "classvar" with the window's class.  Populate the variable "titlevar" with the window's title.  The window must contain the objects: names = "Google", values = "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png", classes = "Internet Explorer_Server", types = "Picture", X = "", Y = "", Check names = "YES", check values = "YES", check classes = "YES", check types = "YES", check positions = "".  Create and populate dataset "thedataset" with details of the window(s).  

 

<AMWAITFORWINDOW WINDOWTITLE="Google - Windows Internet Explorer" ALLOWHIDDEN="YES" WINDOWHANDLEVARIABLE="handlevar" WINDOWCLASSVARIABLE="classvar" WINDOWTITLEVARIABLE="titlevar" CONTAINSOBJECT="YES" OBJECTNAME="Google" OBJECTVALUE="http://www.google.com/intl/en_ALL/images/srpr/logo1w.png" OBJECTCLASS="Internet Explorer_Server" OBJECTTYPE="Picture" CHECKOBJECTNAME="YES" CHECKOBJECTVALUE="YES" CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" RESULTDATASET="thedataset" FOCUSWINDOW="YES" />

 

↑ Top of Page