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.
General Notes

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

Variables marked monitored will cause the relevant monitor to startup to track their state when they are used in contexts or tasks which are used by widgets or enabled profiles. For instance, %CELLS used in a Flash action will cause cell location to be tracked.

Limitation: monitored variables cannot be detected in anonymous shortcuts.

Note On Location Variables

When the relevant provider (Net or GPS) is active, these variables report the values from the provider, which may be more recent than Tasker has seen if other applications are asking for location.

When the relevant provider is not active, these variables report the last values seen by Tasker, which could be the result of a Get Location action or of monitoring for a Location Context.

That means the the reported fix times could go backwards, if you turn off the location provider between two uses of the variables.

User Variables

The actions Variable Set can be used to create new variables. Variable names have the following restrictions:

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.

Variables In Plugins

From Tasker version 1.0.10, plugin developers can tell Tasker to replace variables it finds in plugin strings with their current Tasker value. If you have a plugin which doesn't support this, send the developer this URL
http://tasker.dinglisch.net/plugins.html

which has the relevant details.