Search object on screen


This step is designed to find objects (windows, buttons, menu items, text fields, and any other elements) on the screen by its description. Moreover, MouseRobot is able to find objects in inactive and closed boxes, and will automatically scroll the contents to the desired object, if necessary.

The object can be set using the search description or reference. In the first case, the object can be selected directly on the screen when you add a step or click the "Change object" and its properties will be listed in the table "Search object description".

Search object by description

The Search object description is created automatically when selecting an object, but further it can be changed. For example, changes may be necessary if you want to search a few similar objects with different names In this case instead of an object, you can specify a variable, the value of which will change in the cycle. You can also change the search object description, using the command "Change object", as well as buttons and commands "Add", "Edit" and "Delete" from the context menu of the table "Search description".

Each line of search descriptions corresponds to the object of a certain level of nesting. Therefore, the first line corresponds to the window of the program, while the second to an object or a certain region in the window and so on.

The dialog "Object Properties" serves for changes, it is called by the command "Add" and "Edit".

Object properties editor

Field "Role" defines the type of object. Valid values of the field, you can choose from the list. Example values: WINDOW - a window, CLIENT - the interior of the box, BUTTON - Button, COMBOBOX - drop-down list, TEXT - text field, etc.
Field "Class" is the name of window class for the object.
"Name" field defines the visible to the user or the internal name of the object.
"Value" field lets you specify what value should be an object. For example - the text entered in a text box or an address for the hyperlink.
Field "Module" is the name of the executable file, which owns the object.
The field "Key" is a key or key combination assigned to the object.
The field "Action" is the action assigned to the object by default. For example, a button the default action is "Press".
Field "Description" and "Parent ID" are associated with an object and its numerical identifier in the list of  top-level object subelements.

Search object by reference

Except for explicitly specified search description, the object can be set by the "Link" - a variable or function of Mouse Robot. For example, as a link, you can enter {LastControl} to search on screen for the object found by the previous step, or {ChildControl ({LastControl}, 2} to find on the screen a sub-element with index "2" of the last found object, and so on.

 

The field "Send to object" allows you to specify the commands to be performed after the detection of the object and move the mouse cursor to it. Most often it is clicked - "{MKEY LEFT, CLICK}", but any other tags or sets of tags can be used, as well as variables and functions of MouseRobot, for example {ControlCheck} to activate the object - the check box, or {ControlDoDefault} to perform the operation, assigned to the object by default, for the button it is pressed, for the check box - switches, etc.
The field "Minimal similarity" allows you to change the admission of objects used in the algorithms for Advanced Window Recognition™. The default value corresponds to 70%. This means that if the detected object will be different from the unknown more than 30%, it will not be accepted by the program and the step will fail. Such an admission is necessary because when the properties of an object differ from the earlier description of the search the size and position of the window, the toolbars in it can change. When MouseRobot finds a similar but different object instead of the one sought, the increase of the value of this parameter can help.

If the performance step was successful, the running program or command is stored in the variable {LastControl}, and can be used for further control of the programs performance and search for objects in it.

There is an opportunity to remember the link to the found object in a variable by specifying its name in the "Assign result to variable" in "Common" panel. In addition, the link to the found object is automatically available through the built-in variable {LastControl}.

In order to assess the success or failure of the step you can check the value of the automatic variable {LastResult}. If it is a successful step the {LastResult} = "OK".