Custom filters let you customize and define how your action executes. You can do this by either uploading a previously defined script file or by writing a new one.
MarkVision Messenger provides a very simple scripting language to define filters. The following is a complete list of the statements and conditions you can use to write a custom filter:
Statements:
Conditions:
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 statement was 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")))
In this example, And
was used to build a compound condition. The
While
loop is only entered or repeated if the event is active for
Tray 3. The code within the loop is the same as the code for the Trigger
on Active filter, except the TimeIsAfter
condition is set to
wait 1200 seconds (20 minutes).