Variables

General

A variable is a named value which changes over time e.g. the level of the battery, the time of day.

When Tasker encounters a variable name in a text, it replaces the name with the current value of the relevant variable before carrying out the action.

The main purposes of variables are:

Variable Lifetime

Variable values should persist while Tasker is installed, even over a reboot of the device.

Built-In Variables

The values of Built-In variables are updated by Tasker.

Variables marked dynamic in the list above trigger changes in Variable Value states and Variable Set events whenever their value changes.

User Variables

The actions Variable Set can be used to create new variables. Variable names must start with the % character and have at least a further 3 alphanumeric characters.

Uninitialized Variables

User-variables which have not had a value assigned do not have replacements carried out e.g. in the expression I love %FRUIT, if %FRUIT is uninitialized, the expression remains as it is, otherwise %FRUIT is replaced with the value.

Exception: uninitialized variables used in mathematical expressions are replaced with 0.

Variable Actions

There are several actions dedicated to direct manipulation of variable values. They're all in the Variables category.

In addition, you can read lines or paragraphs from a text file into a variable with the actions Read Line and Read Paragraph in the File category.