Custom variables

<< Click to Display Table of Contents >>

Navigation:  Several practical recommendations > Using Variables in Tasks >

Custom variables

 

RoboTask allows you to save intermediate data in users variables. There is also a whole set of actions that cannot work without user variables. For instance, loops. While using variables, you should remember about some peculiarities.

 

User variables are global for all tasks

It means that one and the same variable is visible, can be used and can be modified in any task. On the one hand, it is very convenient: data can be passed from one task to another. But on the other hand, if you have two tasks running simultaneously, they use one and the same variable and it is done unintentionally, you may get a completely unexpected result.

 

Tip

If you use variables that are not supposed to be used in other tasks, use special prefixes of this task in the names of these variables.

For example:

TSK1_Counter, TSK1_CurrentFile, etc.

Also you may simply declare necessary variables as local. See Local variables topic

 

RoboTask saves user variables for future sessions

Variables you create in tasks are stored until you remove them using the «RoboTask variables» form (Options | Variables) or the «Remove Variable» action inside the task. When you exit RoboTask, variables save their values for future sessions.

As a rule, variables make sense only for the task they are created in and after using RoboTask for a while, you may get a rather long list of user variables that you do not need anymore.

 

Tip

Insert actions removing unnecessary variables at the end of tasks.

 

note Related Topics

Using Variables

System variables

Local variables

Create a Variable

Add Variables to a Task

Saving of a result into a variable

Rules for using variables in expressions

How to use variables correctly

Options > Variables