Calc Example#
Let's consider an example of a robot that demonstrates the use of indexes in the selector for random calculations in a calculator. This robot generates a random number, which corresponds to the button it will click in the calculator interface.
The robot project consists of a single diagram, which looks as follows (for convenience, the blocks of the diagram are numbered):
- Block "Start" (this block is where any diagram begins).
- Block "Launch Application" launches the specified application with the given parameters. The following properties are specified for this block:
- Application Path (the path to the application being launched);
- Wait for Launch (the set flag pauses the script until the specified application is fully launched);
- Selector (allows you to interactively select the application that will be launched using the selector).
- Block "Pause" pauses the execution of the script for a specified time. The following properties are specified for this block:
- Unit of Measurement (the unit of measurement in which the duration of the pause is specified);
- Duration (the number of seconds for which the script will be paused).
- Block "Random Number" generates a random number with specified parameters. The following properties are specified for this block:
- Min. Value (the minimum value for the random number);
- Max. Value (the maximum value for the random number);
- Step (the step for the random number).
- Block "Assign Value to Variable" sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to a specific variable.
- Blocks "Click Mouse" perform a click on the specified element of the application. Selectors are used for these blocks.
In the first selector, a click occurs on the button with the number that was obtained earlier through the "Random Number" block.
In the second selector, a click occurs on the addition button (+).
- Block "Random Number" generates a random number with specified parameters. The following properties are specified for this block:
- Min. Value (the minimum value for the random number);
- Max. Value (the maximum value for the random number);
- Step (the step for the random number).
- Block "Assign Value to Variable" sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to a specific variable.
- Blocks "Click Mouse" perform a click on the specified element of the application. Selectors are used for these blocks.
In the first selector, a click occurs on the button with the number that was obtained earlier through the "Random Number" block.
In the second selector, a click occurs on the addition button (+).
- Block "Pause" pauses the execution of the script for a specified time. The following properties are specified for this block:
- Unit of Measurement (the unit of measurement in which the duration of the pause is specified);
- Duration (the number of seconds for which the script will be paused).
- Block "Press Keys" emulates key presses on the keyboard. The following properties are specified for this block:
- Block "End" (this block concludes the execution of the script or returns the subprocess diagram to the main process).