UiBot : Robots for Everyone!

Your Location: Training Center> Documents > 11.Target selection
11.Target selection

UiBot provides a fully automated way to select targets, as illustrated by the "Click on Target" command in the "Mouse" category.

Suppose we want to do the simplest process. There is only one step: click the Windows Start Menu button (the default location is in the lower left corner). First, create a new process, then open the only process block. Next, in the Visualization View, find the "Click on Target" command and insert it into the Assembly Area by dragging or double-clicking. You should be familiar with the above steps. If you are not familiar with them, please go back to the chapter on Basic Concepts.

In the Assembly Area, there should now be a command. You will notice that there is a button on this command that says "Select Target” with an icon that looks like a sighting device.

When you click the button, the UiBot interface is temporarily hidden, and a translucent mask with red edges and a blue background appears which we call the Target Selector. Wherever the mouse moves, the Target Selector appears until we click the left mouse button in which case the target selector disappears, and the UiBot interface reappears. When pressed, the interface elements covered by the target selector are the targets we choose.

As mentioned earlier, interface elements may be nested, and the location of the mouse may have fallen within the scope of multiple interface elements. At this point, the Target Selector will automatically select the interface elements that you will most likely need and hide them. As a result, before pressing the mouse, please move the mouse patiently until there are aren’t many target selectors that obscure the interface elements you want to operate on.

We can try to hide the start menu button with the target selector. Notice that it in fact does hide. When the mask becomes the state shown in the figure below, click the left button to complete the selection. The following picture is what it looks like in Windows 10. For other versions of Windows, it may look different, but the principle remains the same.

Select the Start Menu Button with Target Selector

Once selected, the UiBot interface reappears, and the "Select Target" button becomes a thumbnail of the target interface elements after being pressed. This thumbnail is only for your reference to help you remember which target you just selected without any impact on the operation of the process. Moreover, the thumbnail is a button, and when pressed, it acts exactly like the "Choose Object" button. If the previously selected target is inappropriate or inadvertently wrong, just press this button again.

If we pay a little attention to the command with a target, we will find that one of the attributes of the command is called "target.” When we haven't selected a target yet, the value of this attribute is a pair of curly braces {}, as shown on the left (there is no target selected at this time, so if it runs, it will be wrong). When we select the target, the value of this property will be bigger, but it will still be surrounded by a pair of curly braces, as shown on the right.

The Value of the "Target" Attribute

You might as well paste this long value here. It looks exactly like:

{"wnd": [{"app": "explorer", "cls", "Shell_TrayWnd"}, {"cls", "Start", "title", "Start"}}}

When we finish learning UiBot's programming language BotScript later, we will know that this long list of content is actually a "dictionary" data 31 type in BotScript. Of course, you don't need to know these details now, just know that this is a special piece of data. When UiBot runs the process, based on this data, we can find the interface elements we specified.

If you have experience in Windows application development, you will know that there are actually many development frameworks for Windows applications, including SDK, MFC, WTL, Windows Form, WPF, QT, Java and so on. If you add Web applications running in IE and Chrome browsers, there will be more types. These applications provide interface elements to find and operate. Technically, UiBot is just calling these interfaces. However, the invocation methods of these interfaces are different, even very different. Even IT experts can hardly master all of these interfaces in a short time, let alone ordinary users. But if you use UiBot, they are all the same "interface elements" and there is no difference in their search and operation. For example, there may be a button in the MFC program and a button in the Chrome browser, which seems to be button-heavy, but the technical differences between these two buttons can be said to be very different. In UiBot, you don't need to care about these differences at all. UiBot has erased them for us. Thus, the unification and balance of the three indicators of "strong", "simple" and "fast" are realized.

Are You Ready to Explore the RPA World?