Syntax
SetWindow
x,y,w,h,s
[Caption="<caption>" | Handle=<hwnd>]
[Class="<class>"]
[Timeout=<secs>]
[Exclude=<handlelist>]
[Result=<var>]Description
Wait for a window to appear and then set its size and position.Parameters
x,y,w,h,s
- The screen position (x,y) of the upper left corner of the window, the width and height (w,h) of the window, and the show parameter (s). Show parameter values are
0 hidden
1 normal
2 minimized
3 maximizedCaption="<caption>"
- The window's title bar text. This parameter, together with the optional Class parameter is used to identify the window. If the last character of the caption is an asterisk (*), then the search is for a window whose title bar text begins with the characters preceeding the asterisk. If the first character of the caption is an asterisk, then the search is for a window whose title bar text ends with the characters after the asterisk. If the first and last characters are both asterisks, the search is for a window whose title bar text contains the text between the asterisks. Either Caption or Handle must be supplied.
Handle=<hwnd>
- The window handle of the window to set. The window handle must have been obtained from a previous SetWindow, WaitForWindow, or ChildWindows statement's Result. Use of this parameter instead of Caption (and Class) results in much faster processing of the statement. Either Caption or Handle must be supplied.
Class="<class>"
- Optional. The window class of the window. This parameter is used to further refine the window search. This is useful for example when an application's pop-up dialog box has the same title as the application main window. The Class parameter is included automatically by the recorder.
Timeout=<secs>
- Optional. The period in seconds after which execution of the script will continue regardless of whether the window was found. If a timeout occurs, the variableTimedOut is set toTrue. Otherwise, it is set toFalse. If the Timeout parameter is not specified, the TimedOut variable's value is not modified. A timeout value of zero causes an immediate timeout if the window is not already visible.
Exclude=<handlelist>
- Optional. This parameter specifies a list (a CSV list) of window handles that are to be ignored in the search for a matching window. These handles must have been obtained in an earlier SetWindow, WaitForWindow, ChildWindows, or other call that returns a window handle.
Result=<var>
- Optional. This parameter specifies a variable into which the window handle of the window is inserted. This value can then be used in subsequent SetWindow and Wait ForWindow statements.
Example
SetWindow 68,63,286,345,1
Class="Notepad"
Caption="Notepad*"
Timeout=5The above line waits 5 seconds for a Notepad window to appear. If such a window appears (or is already visible) it is relocated to screen coordinates 68,63, resized to 286x345, and restored if it was minimized.