A common use for variables
In the following example, we track the power state of a television and eliminate potential delays a customer
can face.
Watch Cable
macro:
Typically, when this macro is executed, four things happen:
1. A command is sent to turn the TV
On
2. A
5 second delay
is added to allow time before the television can accept the next command
3.
HDMI1
command sets the TV to the correct input
4. A
Jump
command takes the user to the cable page
The problem:
Although this works when the TV is initially turned on, what if the TV is already ON? In this
case the user would need to wait 5 seconds before he/she is presented with the Cable page.
The fix:
Use a variable to track the TV’s power state, by creating a variable named
TV Power On
and set its
initial value to
False
(meaning the TV is OFF). The new macro should look like this:
1. We look at the variable named
TV Power On,
and take one of two paths:
a. If (TV Power On=False)
i. A command to turn the TV
On
is sent
ii. A
5 second delay
is added to allow time before the television can accept the next
command
iii.
HDMI1
command sets the TV to the correct input
iv. The variable is then set to
True
(ON)
b. Else (TV Power On=True)
i. Do nothing
2. A
Jump
commands takes the user to the cable page
In this case, if the TV is already ON, the button simply JUMPS to the correct page and does not waste the
user’s time by inserting the delay.
For step by step detail, refer to “Using Variables for Devices that have Power Toggle” within the Appendix
section of this manual.
22
M
X
-
i
O
S
i
P
A
D
/
i
P
H
O
N
E
R
E
M
O
T
E
Complete Control Mobile Programming Manual for MX-iOS