Skip to content

ZeroTrace HID

Conditions

Branch a script with IF / ELSE_IF / ELSE / IF_END and string or numeric comparators

IF runs the commands up to its matching IF_END only when a condition is true. Conditions compare two quoted operands with a comparator between them.

Syntax

IF "<a>" <comparator> "<b>"
<commands>
IF_END
  • Both operands must be quoted.
  • The comparator is detected only between the two operands, so operand text containing is, !=, < and so on is never mistaken for the operator.
  • If no valid comparator is found (or a numeric comparator gets non-numeric operands), the condition is treated as false.
IF "admin" is "admin"
writeLn "Access granted"
IF_END

Operands are expanded

Same expansion as while

Operands are run through variable and operator expansion before the comparison — ${var}$ references resolve and _$ operators evaluate, exactly like a while condition. This is why IF and while now behave identically on the same operand text.

_@ state values resolve to lowercase when expanded through ${…}$ (for example windows, on, off), so always compare against a lowercase literal.

_$VAR os = "_@detectedOS"
IF "${os}$" is "windows"
terminal 'windows' powershell
IF_END

Comparators

String comparators work on any value. The numeric comparators only evaluate when both operands parse fully as numbers; otherwise the condition is false.

ComparatorAliasTypeTrue when
is==stringOperands are exactly equal (case- and space-sensitive)
is not!=stringOperands are not equal
<numerica is less than b
>numerica is greater than b
<=numerica is less than or equal to b
>=numerica is greater than or equal to b
IF "5" < "10"
writeLn "5 is less than 10"
IF_END

ELSE_IF and ELSE

IF blocks support ELSE_IF <cond> and ELSE branches and can be nested. Exactly one branch runs — the first whose condition is true.

_$VAR os = "_@detectedOS"
IF "${os}$" is "windows"
terminal 'windows' powershell
ELSE_IF "${os}$" is "macos"
terminal 'mac'
ELSE
terminal 'linux'
IF_END

ELSE_IF reuses the same comparator set as IF, and every branch's operands must be quoted.

Command Palette

Search for a command to run...