FindObject
FindObject>parent_handle,ClassName,CaptionText,Instance,return_handle,X1,Y1,X2,Y2,return_text
Locates a control given its parent's handle, its class name and either its caption text or instance. Returns the control's handle, its rectangular bounding screen coordinates and any published caption text. If an Index is specified the caption text value is ignored. Where only one object with the given class name exists on the parent window/object instance would be 1. Where 2 exists, 1 would return the first item and 2 the 2nd.
FindObject can be used in conjunction with ObjectSendText and ObjectSendKeys to send keystrokes directly to a control. Use the "Send Keys To Object" wizard to locate the control and generate the code automatically.
FindObject Example
//Get the text from Notepad's editor:
GetWindowHandle>Untitled - Notepad,hWnd
FindObject>hWnd,Edit,,1,hWnd,X1,Y1,X2,Y2,result
//Locates the Windows start button, returning its position and caption text
FindObject>0,Shell_TrayWnd,,1,hWnd,X1,Y1,X2,Y2,result
FindObject>hWnd,Button,,1,hWnd,X1,Y1,X2,Y2,result
//Send keystrokes directly to Notepad's edit control (Notepad does not require focus)
GetWindowHandle>Untitled - Notepad,hWndParent
FindObject>hWndParent,Edit,,1,hWnd,X1,Y1,X2,Y2,result
ObjectSendKeys>hWnd,{"Hello World"}
GetCheckBox
GetCheckBox>window_title,object_caption,result
GetCheckBox determines whether or not the given check box, or radio button, is checked. result is set to 1 if checked, 0 if not checked, or -1 if the command failed to locate the given check box. Specify the window title of the window containing the check box/radio button, and the object's caption. The caption of a check box or radio button is the text appearing next to it. The caption must be specified accurately with attention paid to case. Where a letter is underlined indicating a shortcut key, enter the '&' character before it.
window_title can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation : CBX
GetCheckBox Example
GetCheckBox>Internet Explorer Prop*,Never dial a &connection,res
If>res=1
MessageModal>The checkbox is checked!
Else
MessageModal>The checkbox is not checked!
Endif
GetControlText
GetControlText>WindowTitle,ClassName,Instance,Result
Returns the text of the control specified by ClassName and Instance on the window specified by WindowTitle.
Result contains the text of the control if found. It the window is not found Result contains ##NOSUCHWINDOW##. If the class and instance was not found ##NOSUCHOBJECT## is returned.
If WIN_USEHANDLE is set to 1 WindowTitle must be a window handle.
A window may contain several objects of the same class name. Instance is used to determine which instance of the class to use.
GetControlText retrieves the published text property of the specified object. Not all text that you see on the screen is retrievable in this way. Some text is painted via lower level routines and some text is graphical. Some objects, such as labels, are not windowed controls, and therefore text associated with them cannot be retrieved with GetControlText. Try the new GetTextAtPoint, GetTextInRect and GetWindowTextEx commands which use lower level hooks to trap more text.
Abbreviation: GCT
GetControlText Example
GetControlText>Notepad*,Edit,1,npEdit
npEdit will now contain the contents of the notepad edit window.
GetFocusedObject
GetFocusedObject>handle
Returns the handle of the currently focused object.
Abbreviation: GFO
GetListItem
GetListItem>WindowTitle,ClassName,Instance,Text,Column,Case,Partial,Result,Handle
Returns in Result the row index of the text specified in Text in the specified ListView (List Box) object.
- WindowTitle: The title of the window containing the ListView object
- ClassName: Usually SysListView32 but may differ. Use View System Windows to determine class name.
- Instance: The zero based index of the instance to use (a window may contain several listview objects).
- Text: The text to search for in the list box.
- Column: The column number to search in. 0 for first column or if only one column.
- Case: 1 to perform a case sensitive match, 0 for non-case sensitive.
- Partial: 1=partial, 0=full. A partial match will match Text at the start of the item text.
- Result: Gets set to the zero based index of the item or -1 if not found.
- Handle: Gets set to the handle of the ListView object.
The zero based index is returned in Result. Handle will be set to the handle of the ListView object.
Some list boxes allow you to "drill down" to the item you want by typing the value of the item. To select an item in these kinds of boxes all you therefore need to do is send keystrokes to them using the Send command. However, some list boxes do not "drill down" and this is where GetListItem is needed. You may know the item text you want to select but can not predict it's index. Use GetListItem to retrieve the index and then you know how many times to "Press Down".
WindowTitle can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation: GLI
GetListItem Example
This example uses GetListItem to retrieve the index of an item in the Display Properties backgrounds box.
//Open Display Properties
Run>rundll32 shell32.dll,Control_RunDLL Desk.cpl
WaitWIndowOpen>Display Properties
//Select Desktop Tab
Press CTRL
Press TAB
Release CTRL
WaitReady>0
//Get listindex of "Azul" in Background box
GetListItem>Display Properties,SysListView32,0,Azul,0,0,0,nDx,lvHwnd
//Select it
Press Home
Press Down * nDx
WaitReady>0
//OK!
Press Enter
GetTreeNode
GetTreeNode>WindowTitle,ClassName,Instance,Text,Case,Partial,Result,Handle
Returns in Result the index of the visible tree view node whose caption matches Text.
- WindowTitle: The title of the window containing the TreeView object
- ClassName: Usually SysTreeView32 but may differ. Use View System Windows to determine class name.
- Instance: The zero based index of the instance to use (a window may contain several treeview objects).
- Text: The text to search for in the list box.
- Case: 1 to perform a case sensitive match, 0 for non-case sensitive.
- Partial: 1=partial, 0=full. A partial match will match Text at the start of the item text.
- Result: Gets set to the zero based index of the item or -1 if not found.
- Handle: Gets set to the handle of the TreeView object.
The zero based index of the node is returned in Result. Handle will be set to the handle of the ListView object. Only visible nodes are searched.
WindowTitle can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation: GTN
GetTreeNode Example
This example uses GetTreeNode to retrieve the index of an item in Explorer's Folders treeview.
//Assumes Windows Explorer is open at "My Documents" with
//explorer bar showing Folders
GetTreeNode>My Documents,SysTreeView32,0,My Computer,1,1,result,handle
Let>WIN_USEHANDLE=1
SetFocus>handle
Let>WIN_USEHANDLE=0
Press Home
Press Down * result
Press Right
PushButton
PushButton>window_title,button_caption
Attempts to 'click' the specified button of the specified window.
window_title can contain an asterisk (*) as with all other window functions. For buttons that have a hot key associated with them, and represented on the button by an underscored letter, pass a & character before that letter. e.g.: for a button called 'Close', send &Close.
This command works by attempting to send the BM_CLICK message to the button when it finds a button in the specified window with the given caption.
This will only work with objects of the standard 'Button' class. It may not work for all buttons on all windows. For instance, it doesn't work for buttons on html documents, as they are not real buttons. For these use the MouseOver command.
If the last character of the window title specified is an asterisk (*), script will attempt to locate the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and stops at the first one it finds whose title contains the entered text. This solves the problem with applications such as Word or Netscape which change their titles depending on the document loaded. It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names. Specifying text without a trailing asterisk will force script to only look for an exact match.
window_title can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation : PUS
See also: MouseOver
PushButton Example
Run Program>rundll32.exe shell32.dll,Control_RunDLL TimeDate.cpl
WaitWindowOpen>Date/Time Properties
...
PushButton>Date/Time*,OK
SelectMenu
SelectMenu>WindowTitle,MenuIndex[,SubMenuIndex[,SubMenuIndex[,...]]]
Selects the menu item specified by MenuIndex and optional SubMenuIndex parameters of the window specified by WindowTitle.
MenuIndex and SubMenuIndex are integer numeric values. For MenuIndex 0 is the first menu item on the left of the menu bar, 1 the next and so on. For SubMenuIndex, 0 is the first item in the submenu, 1 the next etc. The index includes separating lines, so remember to count them.
For example, to select the Save submenu item in Notepad, Save is the 3rd Submenu item of the File menu. The File menu is the 1st menu item in the menu bar. So MenuIndex is 0 and SubMenuIndex is 2. There are no further submenus. So the command would look like this:
SelectMenu>Notepad*,0,2
WindowTitle can contain the asterisk wildcard to indicate that it is a substring search (See SetFocus for more explanation). If the WIN_USEHANDLE variable is set to 1 WindowTitle must be a window handle rather than window title.
Note:
SelectMenu only works with standard Windows menus. Many menus are now in fact custom built menus that are other controls made to look like menus. SelectMenu will not therefore work with these objects.WindowTitle can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation: MNU
SetCheckBox
SetCheckBox>window_title,object_caption,TRUE|FALSE
SetCheckBox is used to check or uncheck a given checkbox or radio button. Specify the window title of the window containing the check box/radio button, and the object's caption. The caption of a check box or radio button is the text appearing next to it. The caption must be specified accurately with attention paid to case. Where a letter is underlined indicating a shortcut key, enter the '&' character before it.
window_title can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation : SBX
See also: GetCheckBox
SetCheckBox Example
GetCheckBox>Internet Explorer Prop*,Never dial a &connection,res
If>res=1
SetCheckBox>Internet Explorer Prop*,Never dial a &connection,FALSE
Else
SetCheckBox>Internet Explorer Prop*,Never dial a &connection,TRUE
Endif
SetControlText
SetControlText>WindowTitle,ClassName,Instance,NewText
Sets the text of the control specified by ClassName and Instance on the window specified by WindowTitle.
If WIN_USEHANDLE is set to 1 WindowTitle must be a window handle.
A window may contain several objects of the same class name. Instance is used to determine which instance of the class to use.
WindowTitle can end with an asterisk to indicate a substring match. WF_TYPE, WIN_USEHANDLE and WIN_REGEX directives are also accepted. See SetFocus for a more detailed explanation of how the asterisk, WF_TYPE, WIN_USEHANDLE and WIN_REGEX can be used to define how the window is located.
Abbreviation: SCT
SetControlText Example
SetControlText>Notepad*,Edit,1,Hello World
This will set the Notepad edit window to the text "Hello World".
SetObjectText
SetObjectText>handle,text
Attempts to set the published text property of an object given its handle.
SetObjectText Example
//Set the text in Notepad's editor
GetWindowHandle>Untitled - Notepad,hWndParent
FindObject>hWndParent,Edit,,1,hWnd,X1,Y1,X2,Y2,result
SetObjectText>hWnd,This Text Was Autogenerated!
UIAccessibleList
UIAccessibleList>Window Title,Result
Returns the tree of visual accessible UI objects belonging to the specified window. Returns names, values (if any), positions and dimensions.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIA
UIClick
UIClick>Window Title,Object Name
Performs the default action of the specified accessible UI element for the given window. E.g. for a button this would usually be a click.
Use UIAccessibleList identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIC
UIFocus
UIFocus>Window Title,Object Name
Attempts to set keyboard focus to the specified accessible UI element of the given window.
Use UIAccessibleList to identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIF
UIGetValue
UIGetValue>Window Title,Object Name, Values,Positions
Returns a value or list of values, and positions and dimensions for objects matching Object Name on the given window.
If more than one object is found the values and positions will be delimited by the "|" character. Positions has the format (Xpos,YPos,Width,Height).
Use UIAccessibleList to identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIG
UIPos
UIPos>Window Title,Object Name,Result
Returns the positions and dimensions for objects matching Object Name for the given window. If more than one match is found Result will be a list delimited by "|". The format for each object is Xpos,Ypos,Width,Height.
Use UIAccessibleList to identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIP
UISelect
UISelect>Window Title,Object Name
Attempts to select the specified object.
Use UIAccessibleList to identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIZ
UISetValue
UISetValue>Window Title,Object Name,New Value
If possible will set the value of the specified UI automation element to the new value.
Use UIAccessibleList to identify accessible UI elements.
Window title can be a full case sensitive title or case insensitive substring if followed by the '*' character. A handle can be specified if WIN_USEHANDLE is set to 1 or if WIN_REGEX is set to 1 a regular expression can be used. See SetFocus for more info.
Abbreviation: UIS
Comments
0 comments
Please sign in to leave a comment.