# 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):

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfiTHXDaz-CrPKL5piGUPI2SzvJZACtLFosuUgBcTZmXjQlE_MIFdjk92PGOm-LH9kdd7lfoo9WRs-mpkgiulFghA15vPoOlp56OdBfFl0juBeUK5gGiCio1T_imrckKYF9zMkm41HOYNIS74hMyHdfr_I?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc_2Oyy_j5WHN576XJCV9KWKpYYoNLmJ_sCs7ag7OpeKGGEVfM4sSOzyBHh4FRB-ih8jWUk5yzjwHiy9P6Ws7whHSo7SFFBgyGPGhf2WokBeXQdiwAjhlHP3FyYbhoqkcZ_m9lJ_XGUhW2v5wv7ITZKLtr-?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

1. **Block "Start"** (this block is where any diagram begins).
2. **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).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd6KTcLlSHgdkP02UoW-iX3vYu6zk1XbtBaTra4hr2S30SpsvEwQZNaSdTFpbkffMYwWoi7kTiu9ZQFuR7ENNoXQ-GW5RNP0Vl1YptUOBVB2XW8baLyFULeqb-SaoL8yWGYOIet8rXSLm_bnGHkbRvYHNAj?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

3. **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).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc5n-J7tyZ8Nh-tzqLd_B6npnjieZeQyog_9YF8nO9Yd4wmn6zTzH_3nbFv0-B7puflSs-WTOQ2PPJ2qjkEnZS2kFvje6GofmVjxg6nXpLuEYEv4mgMt3-12zurtgU0kKQ3sJz5IaRmQC9yNaBROdDpjL9E?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

4. **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).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdvTtuU4RRAWFqjmzRztrAB6iNC4VGMbUZOZ2BKt3asm3pURa0m5a5blENAylayJzTkYSboODhc4QKrd_IkUOFKc3CBPSKPkEFhrQN1RMMjUflvLaXQBGrWInVINKfwpoALYVCDQJ9FQjdRAE5mGHyCZGIT?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

5. **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.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdCrFoLghURIEz5AZZJZye9AILjEhBb5GPrTUzxJy7S5BBs4zqnbiDvVh699JQwDddhfFHAv8aj3TRRphM7eqDacmDDOMfqFDFJKkl1XUfrx6aX2BQ_C3jUOMuD78vGFPrKiHB42yCbK2QIrxzqYlb1THsZ?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

6. **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 (+).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfbeRJBRPzAg_S7EvXLeL3L8dVP07MIIExZN0nYw_byE8STF2tjguXRvhpOnHLia9BJL5brOGOjZuWX20J5Pw-GHQ8li4oQQdlCUhWYFqLs7yxFZb9eHgD70Z1iXPPoPm45JsYOkR6224tH0gEcqbBNm2zN?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

7. **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).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfJ7Krr-ru5BcxmMi10TDqkF1g7u2aBGFa0JlwhvVU87TScR2Gk7DdfIUsspGXtT8Hii2W62vynB1D-xaCc1kZCuj0NjrK1cJ8I3Fk7Uqdqwn0HnTld7r8UMPhIX2BQ9waZn_dVSM_6Cd0vvUhq2knA9daY?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

8. **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.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcObw--oX5jNWXDZZbkkjICKF1Xp-aHeH2Swr2Pfzj1gR5LtRaKHFQlKvgeEAVJU5LMNiePN2rGOmkS4FMb4QrKewZsWn0tFxUdRirL6051UjRwmSrsuwtruYIV36IR1AzGpcG-MXxfmm6U4AloRvax2-Bf?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

9. **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 (+).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd0oUDinR5XLbOsWqUYv4FLeEPPJyry3wTzshV42hAvKhWBgDYnlJ3LmI8a3KlGaYohkvF1Xd-lF3h1iuLGjE8z__-LJDBW4uUyLQtYdq3Gnc9RWrPeqf_c3K9eW7oJAWSTQUu1syautwi9yq-Qi-1Oj9cU?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

10. **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).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc5n-J7tyZ8Nh-tzqLd_B6npnjieZeQyog_9YF8nO9Yd4wmn6zTzH_3nbFv0-B7puflSs-WTOQ2PPJ2qjkEnZS2kFvje6GofmVjxg6nXpLuEYEv4mgMt3-12zurtgU0kKQ3sJz5IaRmQC9yNaBROdDpjL9E?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

11. **Block "Press Keys"** emulates key presses on the keyboard. The following properties are specified for this block:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcVFPkn_FThG7Tu-4-T686OJJx4W0nqWHAAYPAM8ZGof5Ke1RLzL5nJxlhDPDUrWIcBq556odG6-G5IluVvNhtddJMkqzDpK1QZIBJSjTLNiJ7ODLKB9R2di9sOQ_ntrqVEvZaC_og1kFA1DrotRRqUK_cU?key=0IUVWPWjCJo2wp2B7nwtag" alt=""><figcaption></figcaption></figure>

12. **Block "End"** (this block concludes the execution of the script or returns the subprocess diagram to the main process).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sherparpa.ru/en/sherpa-rpa/sherpa-designer/primery-robotov/calc-example.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
