Меню

Run script
The activity is located in the Basic section.
Allows you to execute another script in the current script without duplicating it.

To launch the Run Script activity, you need to specify the path to the script file and enter values in the script launch parameters.
Parameters are set in Properties. To do this, click on the Edit...
A window will open:

Script launch parameters can be set manually (1), or imported (2) from the script being run.

Script example
Let's consider an example of a script in which BMI is calculated from the height and weight entered by the user and an interpretation of the result is given.
For example, in the main script, user data is requested and a result is returned, and this data is processed in another script.
Consider the commands of the main script.
1. We request data from the user and store them in the variables h (for height) and w (for weight).
2. Variables received from the input window are strings. In order to be able to perform mathematical operations with them, we will convert them to the fractional number format (Double) and call them a and b.
3. Create a variable result, where the result of executing other code should be saved.
4. Using the Run script command, we run the code ("Calculate BMI"), in which the BMI value is calculated and interpreted.
5. In order to pass the values entered by the user, open the script in a new tab (you can also open the script in the properties tab) and assign the parameters.

a variable that stores information about the resultIn the BMI Calculation script:
1. BMI is calculated.
2. Depending on the value of the index, the corresponding interpretation is determined and stored in the res variable

In order for us to be able to pass the values of variables from one script to another, we need to set the parameters:
(a) a variable that stores information about height;
(b) a variable that stores weight information;
(c) a variable that stores information about the result.
* Don't forget to specify the correct type of variables.

Save script changes.
We return to the main script, (1) click on the Run script command, (2) in the Properties tab, click on the Edit...
We also added a Message Window command to display the result on the screen.

In the window that opens, (1) import the script parameters and (2) set the values that need to be passed: in the main script, height is denoted by variable a, weight - by variable b, and the result is written to the result variable.

All scripts are available for download at the link: