How does MarkVision Messenger work?
97
• Distribute
Conditions:
• And (Condition_1...Condition_n)
• Or (Condition_1...Condition_n)
• EventDataIs (key, value)
• SourceDataIs (key, value)
• TimeIsAfter
As an example, let's look at the script representation of the built-in Trigger on Active filter:
IfThen (EventDataIs("state", "ACTIVE"))
Distribute
The effect of the EventDataIs condition is to ask the event for the value of the event.state keyword.
This is the same keyword you can insert into command lines and e-mail messages. The first
statement, an IfThen, executes the next statement if the condition EventDataIs ("state",
"ACTIVE") is true. An EventDataIs condition is true if the value of the keyword (state) matches
the given value (ACTIVE). The next statement, Distribute, causes the command to execute.
Now, let's look at the script to write when the Trigger on Active filter is set with a delay of 30 seconds:
{
WaitUntil (TimeIsAfter(30))
IfThen(EventDataIs("state", "ACTIVE"))
Distribute
}
The braces ({}) are used to group statements into a list. They were not needed in the previous
example because the IfThen and following statements were treated like a single statement.
The WaitUntil statement causes the script to pause execution until the condition is true. The
TimeIsAfter condition checks for true only after the specified number of seconds has passed.
Once the 30 seconds has passed, if the event is still Active, the Distribute statement executes the
command.
The script representation of the built-in Trigger on Either Active or Clear filter is a single Distribute
statement. Let's say, for example, that you select Paper Tray Missing as the event, but you only want
to execute the command when the event occurs for Tray 3. Also, you want to wait 20 minutes before
executing the command, and execute the command again at the same 20-minute interval if the
condition remains Active. Let's look at the script to write for this filter:
While (And(EventDataIs("state", "ACTIVE"), EventDataIs("location", "Tray 3")))
{
WaitUntil(TimeIsAfter(1200))