Basic Notions

  • There are 8 variables (a, b, c, d, e, f, g, h) which are manipulated by the actions Apt:Var+ , Apt:Var- and Apt:Var0 which increment, decrement and clear a variable's value respectively.
  • There is no action to set a specific value to a variable: just use combinations of the above actions to get that effect.
  • All variables start with value 0 after a reset (or initial install).
  • Variables are global, in that they retain their value across all apps.
  • The purpose of variables is to allow different triggers to act as conditions for other triggers. Each trigger has a 'condition button' to the left of it. Tap on the button to set the variable value that must match for the trigger to execute.

Using Variables

1. Set a Variable to Signal Some Condition

The first step is to set a variable of your choice to a certain value when you want to signal a certain condition.

Here's a simple example:

In target *Default*, Events screen:
(1000) / Time / Apt / Var+: / a

This sets up a time trigger at 10:00 AM that increments variable A by one.

2. Clear the Variable When the Condition Stops

Next, you want to tell Apt to make the variable return to a clear state when the condition stops. In this example, since we want A to be set only between 10:00 AM and 17:00 PM, we need to set up another time trigger:

In the same target *Default*, Events screen, add this:
(1700) / Time / Apt / Var0: / a

This sets up a time trigger at 17:00 AM that clears variable A back to zero.

3. Use the Variable as a Condition in Some Other Trigger

Finally, we can make use of this variable that is set to signal the condition "the time is between 10:00 AM and 17:00 PM" for some effect:

In target Blazer, Events screen:
(a>0) / -Lnch / App / Opera

This means: if a=1 (i.e. if it's between 10am and 5pm) whenever Blazer is launched, launch Opera instead.

Possible Uses

There are many things that can be done, whenever some kind of context is required for a trigger. Some ideas are:

  • signaling when we are inside a form (to get form-based triggers);
  • signaling when we are connected to a network;
  • signaling when we are connected to a battery charger (for example, to launch lengthy battery-draining tasks);
  • for macros that span several apps, using a variable to signal that we have started handling something, go through several apps with partial macros (that run only when that variable is set), then finish by clearing the variable.
  • whatever your imagination is capable of…
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License