FocusWindowContaining Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “Window” group, “Focus Window Containing.” The method attempts to find and focus a window that contains the specified text.

 

Declaration

function FocusWindowContaining(varWindowTitle As Variant,

intExactTitleMatch As Integer,

varTextToFind As Variant,

intExactTextMatch As Integer) As Integer

 

Parameters

varWindowTitle

 The title bar text of the window to search for the specified text. Use “*” here to search all open windows in the system.

 

intExactTitleMatch

 Specifies whether or not the varWindowTitle must be matched exactly. Set to “1” if yes or “0” if a substring match is preferred.

 

varTextToFind

 The text within the window specified by varWindowTitle to be searched for.

 

varExactTextMatch

 Specified whether or not the text inside the window must match varTextToFind exactly. Set to “1” for an exact search or “0” for a substring search.

 

Description

The FocusWindowContaining method will search the window with the titlebar text specified by varWindowTitle for the text specified by varTextToFind. If the text is located, AutoMate™ will attempt to focus the window and bring it to the foreground.

 

To search all the open windows in the system for varTextToFind, set varWindowTitle to “*”.

 

The method returns”1” if a window containing the specified text cannot be found and “0” if the window is found and focused successfully.