Window Trigger

Description

Triggers task execution when the specified window opens, closes, is focused or loses focus.

Practical Usage

Useful in a back office (or unattended) environment to monitor the system for application generated error dialogs. These dialog boxes could be automatically handled when they appear. For example, a notification message could be sent to the system administrator upon the occurrence of an error.

Related Topics  

Parameters

General

Drag the magnifier icon to an open window to have AutoMate automatically detect its properties.

Property

Type

Description

Trigger if/when

Options

The Window related action that will cause this trigger to fire. The available options are:

  • Window open (default) - The trigger will fire if/when the specified window opens.

  • Window close - The trigger will fire if/when the specified window closes.

  • Window focused - The trigger will fire if/when the specified window becomes focused (brought to the foreground).

  • Window not focused - The trigger will fire if/when the specified window loses focus (goes to the background).

Only when the window is first opened.

Yes/No

If set to YES, specifies that the action to be performed on the window being monitored will occur only once when that window first opens and ignore other instances (disabled by default). For example, if this trigger is set to wait for Notepad to close, enabling this option tells the trigger to watch for the first instance of Notepad to open and activate only when that first instance closes. If a second instance of Notepad opens and closes before the first instance, that action is ignored.

NOTE: This option is available only if the Trigger if/when parameter is set to Window open.

Hold focus

Yes/No

If set to YES, specifies that the focused window that caused the trigger to fire will be kept in the foreground (on top of all other windows), preventing all other windows from stealing focus. Set to NO by default.

NOTE: This option is available only if the Trigger if/when parameter is set to Window focused.

By title

Yes/No

If set to YES, the title of the window will be monitored (set to YES by default).

Title

Text

The title of the window to monitor. Click the down arrow to select from a drop-down list of currently open window titles or manually enter the title on the provided text box. This parameter supports wildcard characters (* and ?). For example, entering *Internet Explorer* would include all windows containing the title "Internet Explorer."

NOTE: This option is available only if the By title parameter is set to YES.

By class

Yes/No

If set to YES, the window class will be monitored.

Class

Text

Specifies the class of the window to monitor. A window class is a set of attributes that the system uses as a template to create a window. Every window is a member of a window class. All window classes are process specific. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example, entering *Explore* would include all window classes containing the text Explore (set to NO by default).

NOTE: This option is available only if the By class parameter is set to YES.

By handle

Yes/No

If set to YES, specifies the handle of the window to monitor (set to NO by default)

Handle

Number

The handle of the window to monitor. A window handle is a numeric code that uniquely identifies an open window.

NOTE: This option is available only if the By handle parameter is set to YES.

Window is a child window

Yes/No

If set to YES, specifies that the window to monitor is a child window. A child window is normally a secondary window on screen that is displayed within the main overall window of the application. A child window is a window has the following properties:

  • It has a parent window.
  • It stays always in the parent's client area (cannot be displayed outside)
  • If the parent is moved, the child window is moved in the same way (its position relative to parent's client area doesn't change);
  • it is destroyed when its parent is destroyed.

This option is available only if the Trigger if/when parameter is set to Widow focused or Window not focused (set to NO by default).

Contents

The Contents tab contains standard window dissection parameters (i.e. object name, type, class, value and position) used to describe controls or text in a window. These options are useful in determining windows with identical titles as documented under Window Dissection parameters.

Property

Description

Window must contain the objects

If enabled, allows you to define other window characteristics used to determine a matching window (disabled by default). To select an object from an existing window, click Add and either use the Browse button or drag the hand icon to the area on the screen. Then use the Edit button to edit specific properties.

Behavior

Property

Description

Trigger on startup if condition is true

If enabled, the system will act upon conditions that already exist upon startup of the current trigger. For example, if the Notepad window is already open on the desktop, a newly created Window trigger set to monitor for the existence of a Notepad window will immediately launch the task as a result. If disabled, the trigger will ignore the open Notepad window upon startup. This parameter is disabled by default.

Trigger after the condition has been met 'X' times.

If enabled, specifies how many times the trigger condition must be met before the task is started. For example, if a Window trigger is set to monitor for the appearance of a Notepad window and this parameter is set to 3, the task will not launch until the third instance of Notepad appears on the desktop.

Additional Notes

AMTrigger

When this trigger is activated, it automatically passes the AMTrigger object to the task. AMTrigger is a standard AutoMate dataset and can be used much like the datasets created by the SQL Query and Email actions. The fields of AMTrigger can be used within a task to determine specific values, such as whether or not the task was started by a trigger, which trigger started the task, when the trigger was activated and other properties. AMTrigger populates a unique set of field–value pairs for each AutoMate trigger. The following table lists the ones specific to this trigger. For more details about a specific AMTrigger field–value pair, click the associated link.

Name

Data Type

Return Value

AMTrigger.Action

String

Returns the action that took place to cause the task to trigger.

AMTrigger.WindowClass

Number

Returns the unique window class of the window that activated the trigger.

AMTrigger.WindowHandle

String

Returns the handle of the window that activated the trigger.

AMTrigger.WindowTitle

String

Returns the title of the window that activated the trigger.

 

NOTE: A full list of AMTrigger objects exclusive to each trigger can be viewed from the Expression Builder by expanding Objects -> Triggers and selecting the desired trigger.