XenoGuard 4.0 Documentation

Conditional Branching

The If action in XenoGuard is a powerful tool for implementing conditional queries and decision-making structures. Essentially, the If action allows a script to choose between two pathways: the Then branch and the Else branch. The decision between these branches is based on a specific condition that is evaluated prior to execution. This condition is formed from a left and a right expression, which are compared using a specified comparison operation.

XenoGuard offers considerable flexibility in defining these conditions. Expressions can include identifier values, fixed values, and parameters read by reference. The intuitive drag-and-drop functionality simplifies setting conditions, enabling users to work efficiently and with minimal errors.

In the following example, the value of the referenced parameter File Count is compared to the content of the variable Max File Count. The script enters the Then branch when the number of files reaches a specified upper limit. In such cases, a message box is opened.

Information The ability to perform conditional queries and execute actions based on them is crucial in programming. It allows for responses to changes, inputs, or various circumstances, enabling actions to be taken accordingly. This is particularly vital in dynamic environments or for complex tasks where the program must follow different procedures or reactions based on differing situations. In practice, the If action in XenoGuard makes programs not only responsive but also more intelligent and adaptable to their environment and user requirements.

Change

You can change a comparison condition in XenoGuard either using drag-and-drop or via the dialog box.To proceed, follow these steps:

  1. Using the Mouse: Drag an identifier, a parameter, or an action to the left or right expression field of the If action. The drop cursor will indicate if the operation is permitted.
  2. Using the Keyboard: Select either the left-hand expression, the right-hand expression, or the comparison operation using the arrow keys, then press the Return key to open a dialog box. You can then make the settings using the keyboard.

XenoGuard supports the following comparison operations:

Operation Description
State Examines the result of an action and compares it to the states Passed or Failed.
Usage: To determine if an action has been successfully performed or has failed.
Contains Checks whether the left part of the expression contains the right part as a substring.
Usage: To find specific sequences or patterns in text data.
Contains Not Checks whether the left part of the expression does not contain the right part as a substring.
Usage: To ensure a specific pattern or sequence is not present in a text.
Contains RegEx Checks if the left expression part matches a pattern defined by the right expression part (in the form of a regular expression).
Usage: For complex text search queries where standard string comparisons are insufficient.
Contains Not RegEx Checks if the left expression part does not match a pattern defined by the right expression part (in the form of a regular expression).
Usage: To ensure a text does not correspond to a specific regular expression pattern.
== Checks if the left expression part is equal to the right expression part.
Usage: To confirm the equality of two values or expressions.
!= Checks if the left expression part is not equal to the right expression part.
Usage: To determine the inequality of two values or expressions.
== RegEx Checks if the left expression part exactly matches the pattern defined by the right expression part (in the form of a regular expression).
Usage: To confirm an exact match between a text and a regular expression pattern.
!= RegEx Checks if the left expression part does not match the pattern defined by the right expression part (in the form of a regular expression).
Usage: To confirm that a text and a regular expression pattern do not exactly match.
> Checks if the left expression part is greater than the right.
Usage: For numerical comparisons to determine which value is greater.
>= Checks if the left expression part is greater than or equal to the right.
Usage: For numerical comparisons when an exact match is also to be considered.
< Checks if the left expression part is less than the right.
Usage: For numerical comparisons to determine which value is smaller.
<= Checks if the left expression part is less than or equal to the right.
Usage: For numerical comparisons when an exact match is also to be considered.

Using Loops