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" />
Description: Causes task execution to pause at the current step until a specific 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.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
By title |
Text |
Yes |
(Empty) |
|
The title of the window to wait for. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example entering "*Explorer*" would include all windows that include the word "Explorer" in its title. |
By class |
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 entering "*Outlook*" would include all windows that include the word "Outlook" in its title. |
By handle |
Number |
No |
(Empty) |
WINDOWHANDLE="555735" |
The handle of the window to wait for. The window handle is a unique reference value set for an open window. If set to 0 or omitted, this parameter is ignored. |
Action |
Text (options) |
Yes |
Open |
|
Specifies the action to wait for. The available options are:
|
Focus found window |
Yes/No |
No |
No |
FOCUSWINDOW="YES" |
If set to YES, denotes 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. |
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. |
Window Contents
This section contains standard Window Dissection parameters used to define additional window characteristics to determine a matching window. To specify additional window characteristics, enable the option Window must contain the objects, press the Add button then drag and release the magnifier icon over the desired window object or control. The Object properties grid 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 (e.g., * 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 (e.g., * or ?). This parameter is ignored if the Object position must be parameter is set to NO. |
Advanced Parameters
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 window title in variable |
Text |
No |
(Empty) |
WINDOWTITLEVARIABLE=VarName" |
If enabled, specifies the name of an existing variable that should be populated with the title of the window to wait for. |
Populate window class in variable |
Text |
No |
(Empty) |
WINDOWCLASSVARIABLE="VarName" |
If enabled, specifies the name of an existing variable that should be populated with the class of the window to wait for. |
Populate window handle in variable |
Text |
No |
(Empty) |
WINDOWHANDLEVARIABLE="VarName" |
If enabled, specifies the name of an existing variable that should be populated with the handle of the window to wait for. |
Create and populate dataset |
Text |
No |
(Empty) |
RESULTDATASET="DatasetName" |
The name of a dataset to be created and populated with the window title, class and handle of the window to wait for. |
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
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. |
Example
The sample AML code below can be copied and pasted directly into the Steps panel 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" />