Control Flow
Control flow is used mainly for tracking the state of equipment
and executing commands depending on the anticipated state.
Essentially control flow controls the behaviour of a macro
based on flags that have previously been set or cleared, either
by the same macro or by other macros. Aside from using it to
track the expected state of equipment, it can also be used for
implementing simple applications such as a page requiring an
access-code.
A control flow instruction can be added to a sequential macro
using the context menu (right click the list) and selecting an
instruction under “Flags and control flow”.
When an instruction involving a flag is used, a dropdown list of
all the flags is displayed. The user can select an existing flag or
select “<new flag>” to create a new one. Up to 32 flags can be
defined. Names can be assigned to the flags by editing the
default flag name.
The instructions for testing the state of flags always contain a “then” branch and an “else”
branch. The “then” branch is a sequence of commands that is executed when the state of the
flag matches the state required by the instruction. To avoid confusion, this branch should
always be used and not be left empty. The “else” branch is a sequence of commands that is
executed when the state of the flag does not match the required state. This branch can be
left empty should it not be needed.
The example macro shown above emulates an alternating macro that transmits the infra-red
commands “Source 4”, “Source 5” and “Source 6”.
28