Control Structures
Loops allow you to execute actions multiple times automatically, either by repeating an action or iterating through data.
In MacroDroid, there are two main categories of loops:
1. Iterate Dictionary / Array
This loop goes through every element in a dictionary or an array, executing the enclosed actions for each one.
Available Magic Text
{iterator_value}— Value of the current element (works with both dictionaries and arrays).{iterator_dictionary_key}— Current key (dictionaries only).{iterator_array_index}— Current index (starts at 0, arrays only).{loop_iteration}— Current iteration number (starts at 0).
2. Repetition Loops
Fixed Number Executes the actions a specific number of times.
While "Condition" repeat Evaluates the condition before each iteration. If the condition is false from the start, the actions are never executed.
Do Once and repeat while "Condition" Executes the actions once, then evaluates the condition to determine whether to continue repeating.
Repeat for a Time Period Executes the actions for a specified amount of time (e.g. 30 seconds).
Endless Loop (Until break) Executes indefinitely until an Exit Loop action is encountered.
Available Magic Text
{loop_iteration}— Current iteration number (starts at 0).
Important Notes
- The
iterator_*Magic Text values only work inside the Iterate Dictionary / Array loop.
