|
Which Window
Locates a window from all open windows on the desktop.
Parameters
Find window by caption/class name/handle Specifies to search for the window by the properties of the window.
Title of window must contain Specifies the title of the window that the search should be restricted to.
Class name of window must contain Specifies the class name of the window that the search should be restricted to.
Handle value of window must be Specifies the handle value of the window.
Match whole words Specifies whether to search only for whole words that match the search content.
Include hidden windows Specifies whether the hidden (non-visible) windows should be included in the window search.
Find foreground window Specifies to retrieve the current active window.
Find next window to the foreground Specifies to retrieve the next window to the current active window.
-
Find window by window path Specifies to locate the window by a window path.
Window Path
In Windows system, different windows on the desktop are hierarchically interrelated with one another, integrated in a manner that resembles a tree. The terms parent, child, sibling and path are used to describe the relationships.
- In the window tree, the top window is called the root (desktop window)
- Every window has exactly one parent, except the root (which has no parent)
- A window can have a number of children
- Siblings (brothers or sisters) are windows with the same parent
- A window path consists of the window of all the tree windows that must be navigated to reach specific window, starting at a top window.
First Example
<Notepad[title ^= 'Untitled']>(2).<Edit>
Example Explained
- There are two nodes in this path, <Notepad[title ^= 'Untitled - Notep']>(2) and <Edit>
- The nodes are separated by the period character
- The node is surrounded by angle brackets with the ordinal number followed by
- The text between angle brackets are window class name and the filter expression, the filter expression is surrounded by square brackets
- The ordinal number is surrounded by parentheses
Syntax of Window Path
<Window class name [Filter expression]>(Ordinal number).<Window class name [Filter expression]>(Ordinal number)...
A node in path is consist of the window class name, filter expression and ordinal number. The node begins with a left angle bracket (<), followed immediately by the window class name. An optional filter expression surrounded by square brackets can follow the window class name. A right angle bracket (>) closes the node. An optionally ordinal number surrounded by parentheses can follow immediately the node close character (>). Multiple nodes in path are separated by the period character (.). The wildcard characters * and ? are allowed to instead of one or more nodes.
Term | Description |
Window class name |
Specifies the window class name which is the ID to distinguish one class of window from another. The wildcard character * and ? are allowed. |
Filter expression |
Optionally, specifies an expression for the window. Filter expression is used to block from the windows that does match the condition. The filter expression must be surrounded by square brackets.
Note The variable cannot be used in the filter expression. |
Ordinal number |
Optionally, specifies the ordinal number that denotes a matched window. The ordinal number starts zero. |
Examples
A simplest window path that includes the window class name only.
<Notepad>
The second Notepad window with the title "Untitled" started.
<Notepad[title ^= 'Untitled']>(2)
The filter expression has two conditions.
<Notepad[title ^= 'Untitled' and zoomed=TRUE]>
The wildcard character * is used in the path.
<Notepad[title ^= 'Untitled']>.*.<Edit>
Locates the second Notepad window with the title "Untitled" started.
<Notepad[title ^= 'Untitled']>.?.<Edit>(2)
Attributes in Filter Expression
The following table lists the attributes can be used in the filter expression.
Attribute |
Description |
DataType |
title |
Window text |
String |
class |
Window class name |
String |
visible |
Tests if window is visible |
Boolean |
enabled |
Tests if window is enabled |
Boolean |
checked |
The state of the check box or radio button. |
Boolean |
zoomed |
Tests if window is zoomed |
Boolean |
iconic |
Tests if window is iconic |
Boolean |
haschild |
Tests if window has window any child window. |
Boolean |
inarea |
Tests if window is resided in an area of the parent window.
Syntax: inarea="left_of_area, top_of_area, widht_of_area, height_of_area"
For example: inarea="10,10,400,300". |
String |
screenarea |
Tests if window is resided in an area of the screen.
Syntax: screenarea="left_of_area, top_of_area, widht_of_area, height_of_area".
For example: screenarea="10,10,400,300". |
String |
left |
The position of the window relative to the left edge of the parent window. |
Number |
top |
The position of the window relative to the top edge of the parent window. |
Number |
right |
The position of the window relative to the right edge of the parent window. |
Number |
bottom |
The position of the window relative to the bottom edge of the parent window. |
Number |
sleft |
The position of the window relative to the left edge of the screen. |
Number |
stop |
The position of the window relative to the top edge of the screen. |
Number |
sright |
The position of the window relative to the right edge of the screen. |
Number |
sbottom |
The position of the window relative to the bottom edge of the screen. |
Number |
width |
Width of window. |
Number |
height |
Height of window. |
Number |
Notes
- The variable can not be used in the filter expression. For more information about the expression, click here.
- The window handle is a special number value that Windows System assigns to a window each time it is created.
|