Variables
What are variables?
Variables serve as placeholders for information that changes frequently. (Nearly) everywhere in Yarado where you have a textbox, you can call on a variable, making its use very flexible.
Variables window.
The variables are located at the bottom of the Yarado process visualiser. The
column with Variable Name contains the names of the variables, including their
%%
tags. The Variable Values column contains the corresponding value of the
variable name.
For example, a variable called %name%
with the value "John" means that whenever
you type %name%
in a text box and start the task, %name%
will be replaced by
the variable value "John".
Creating a variable
There are three ways to add a variable in Yarado:
-
Use the variable button in the toolbar.
Variable button in toolbar.
-
Type your variable name in a blank row in the variable window, below the process visualiser (see first image on the page) and hit enter. There is no need to add the surrounding
%%
characters, as these are added automatically. - By calling on your variable in a Yarado function. In case the variable name doesn't exist yet, it will be automatically generated.
Using a variable
Nearly all Yarado steps and functions can use input values provided by a variable or return output to a variable. In most cases, you can call on a variable by typing its name in the text field, by right-clicking in the text field and using the Link User Variables menu to select one or by using the available dropdown menu.
In the image below, you can see an example of three variables.
Example of user variables.
To use these variable values, for example in a Message Box, simply enter the variable name in the place where you want to have its value appear.
Variables in a message box.
Note
When combining multiple variables, you have to enter potential spaces or newlines yourself.
System Variables
In addition to variables created by the user, you can also call on operating system information using system variables. You can call on system variables the same way as you can call on variables you have created yourself. A list of all available system variables and dynamically generated example values are located in the help menu under Show System Variables.
List of system variables.
Tip
Use the system variable %taskpath%
when defining file save locations to
make them dynamic. This prevents your task from breaking when you move your
task or update your machine's folder structure.
Link main and subtask variables
When working with subtasks, it can be useful to exchange information between the
subtask and the main task. To achieve this, make sure the subtask variables you
want to link, have a gl_
prefix in their name. This way, they are considered
global by Yarado. More info on using subtask is available
here.
Global variables