Naming Objects, Spy Tool
The Spy tool included in WinTask x64 allows you to find the name of a window and the parameters for the UseWindow function. It is used too for generating the HTML descriptor of HTML elements displayed on a Web page.
It is used too for generating the UIA descriptor of elements exposed to the UI Automation framework if the application supports it.
Video: How to use Spy on a Windows application
Video: How to use Spy on a web page
Video: How to use Spy on an UI Automation object
To launch Spy tool, click icon in WinTask x64 Editor toolbar or select Start/Spy menu. Spy main window is displayed:
|UseWindow||Argument for UseWindow function|
|Module||Executable module name|
|Index|| Index of the control (when the same control
is used several times inside the window)
|Instance||Instance number (if several instances of the same window are loaded)|
|Handle|| Window handle in hexa - Note that GetTopWindowHandle, GetFocusWindowHandle and GetWindowHandle function return the
handle as an integer
For example, Spy on an emtpy notepad window displays:
It is possible to truncate this window name in the Window name field ; delete rightmost characters if you want to use a truncated window name in a UseWindow function. Click Validate button to check that the window name is still correct. If window name changes from one replay to another, truncate the window name to keep only the beginning of the window name which does not change.
Click Paste button to paste the window name found by the SPY tool into the script. The paste is done where the cursor is in the Editor window, so before pasting, place the cursor in a new line. This pasted window name can then be used as argument for the UseWindow function.
If Spy tool is used on a Web page, the Web Information part of Spy window is filled too. For example, if you load www.wintask.com/demos and if you use Spy to find the HTML descriptor of the Form link, the Spy window is filled like that after having moved the mouse on Form text and clicked once:
HTML tag field returns the tag name for the HTML element where the mouse is.
The Cursor position fields give the mouse coordinates in pixels relative to the top left corner of the browser client window and relative to the top left corner of the screen. They can be used for generating easily the ClickMouse function.
The HTML attributes box gives the different attributes which can be used for generating the HTML descriptor. Select the one that you want to use.
Descriptor INDEX returns the INDEX number which will be used in the HTML descriptor (when two HTML elements have the same descriptor, an INDEX is added for identifying each element uniquely - see HML descriptor topic).
If the HTML element is an element containing text which can be captured by WinTask x64 (Table, Paragraph, ...), Change CONTENT button can be used to change the CONTENT keyword.
The Descriptor field contains the HTML descriptor as you have generated it using the fields above. Click Paste button to paste it into the script.
Click Paste UIA descriptor button to paste it into the script.