On the Wiki there is a detailed example of processing a file contents [External Link].
Tip: if you accidentally create a task that never ends when experimenting with loops, use the KillAll button in the Task Edit screen to end it manually.
A condition consists of an operator ('equals' etc) and two parameters. The possible operators are:
3
< 6
. Expressions can use the four basic operators,
which bind in the order / * - + e.g. if %COUNT is 3, then %COUNT * 20 + 5
is 65
. Operations are performed in floating-point arithmetic.
Expressions which are not mathematically valid e.g. I Am The Walrus > 5 give a warning and evaluate to false when used with a mathematical operator.
Goal: perform a Task X until some condition is met (at least once)
1. | Action One |
... |
2. | Action Two |
... |
3. | Goto Action 1 If %QTIME < 20 |
Return to action 1 if runtime < 20 |
Result: Action One and Action Two are performed until %QTIME contains the value 20 or more i.e. until the task has been running for 20 seconds.
Goal: perform a Task X while some condition is met.
1. | Stop If %FRUIT != Apple |
Stop task if it's not crunchy, otherwise go to next action |
2. | Action One |
... |
3. | Action Two |
... |
4. | Goto Action 1 |
Go back and see if we're still crunchy |
Result: Action One and Action Two are performed while %FRUIT contains the value Apple.
Goal: perform a Task X a set number of times.
1. | Variable Set %COUNT, 0 |
Initialize the counter |
2. | Action One |
... |
3. | Action Two |
... |
4. | Variable Add %COUNT, 1 |
Add one to %COUNT |
5. | Goto Action 2 If %COUNT < 10 |
Return to action 2 if count < 10 |
Result: after initialization of %COUNT to 0, the task loops around the actions from 2-5 until %COUNT reaches 10, at which point the condition on the Goto Action fails and the end of the task is reached.
Goal: perform certain Tasks if conditions are met, otherwise perform a different task.
1. | Perform Task X, Stop = On If %FRUIT = Apple |
Stop and do task X if crunchy fruit, otherwise next action |
2. | Perform Task Y, Stop = On If %FRUIT = Banana |
Stop and do task Y if squashy fruit, otherwise next action |
3. | Perform Task Z |
Other fruit: task Z |