WiseScript Editor Reference
27
Conditions and Loops
Normally, script actions are executed in the order in which they appear in the script.
However, the order of execution can be changed by special script actions called
conditions and loops.
Conditions specify script actions that are executed only when certain conditions are true.
Example: In WiseScript, you can test what version of Windows a destination computer is
running, then execute different script actions depending on the version of Windows
they’re running.
Loops specify script actions that are repeated until a certain condition is met. Example:
You might prompt the end user to enter specific information during installation. To make
sure the information the end user enters meets certain criteria, use a loop to repeat the
prompt until the data entered is appropriate.
If, While, and End Actions
Because a condition or loop can apply to more than one script action, they are defined
using at least two statements: one to mark the beginning of the block of script and the
other to mark its end. The standard action for beginning a condition is the If action, and
the standard action for beginning a loop is the While action. The end of both conditions
and loops is marked using the End action. Script Editor indents everything inside a
condition or loop so you can see which actions are affected.
Else and ElseIf Actions
Conditions can use the Else and ElseIf actions, which mark the beginning of actions to be
executed when the condition described by the If action (or other condition statement) is
not true. The Else action is used between the If and End actions. Actions after the If but
before the Else are executed if the condition is true. Actions after the Else are executed
if the condition is false. Loops cannot have Else statements.
Nesting
In WiseScript, one condition or loop can contain another condition or loop. This is called
nesting. You define a nested condition or loop by adding a second If or While action (or
other start-of-condition or start-of-loop marker) before the End action of the first
condition or loop. The second block of script must be fully contained within the first.
When you add an End action, it always applies to the most recently begun If or While
action that does not already have an End action. You can nest conditions and loops to
many levels, but in most circumstances it won’t be necessary to nest more than three or
four levels deep. The indentation, which increases for each nested structure, helps you
interpret deep nestings.
Connection Lines
Connection lines connect the beginning and end of conditions or loops. To add
connection lines, select View menu > Connections Lines.
See also:
Basic Scripting Concepts
on page 26
Summary of Contents for ALTIRIS INVENTORY 7.0 SP2 - FOR NETWORK DEVICES V1.0
Page 1: ...WiseScript Editor Reference ...
Page 31: ...WiseScript Editor Reference 31 ...
Page 91: ...WiseScript Editor Reference 91 ...
Page 148: ...WiseScript Editor Reference 148 ...