If

Purpose:

Change the flow of script execution, based on the results of a simple comparison of two items. When the statement is True, execution continues until an “EndIf” or “Else” Action is encountered. Otherwise, execution begins with the first line following the next “Else” (optional) or “EndIf” command.

Category:

Conditional

Syntax:

If "first item" operator "second item"

first item

The first item to compare. Can contain text, numbers, math expression, variables, etc.

operator

One of the following:


==

First item is equal to second item.

<

First item is less than second item.

>

First item is greater than second item.

!=

First item is not equal to second item.

<=

First item is less than or equal to second item.

>=

First item is greater than or equal to second item.

===

Exactly equal to (both the value and variable type match)

!==

Exactly not equal to


second item

The second item to compare. Can contain text, numbers, math expression, variables, etc.

Example:

The following example examines the contents of the variable [Name]. If [Name] is empty an error message appears, otherwise, the next page is displayed:


If [Name] == ""
  AlertBox "Error!" "I don’t know your name." ""
Else
  GotoNextPage
EndIf


You can also use If to detect the correct entry of a password:


If [Password] == "Bravo172"
  GotoNextPage
Else
  AlertBox "Error!" "The password is incorrect." ""
EndIf


IfEx

Purpose:

Change the flow of script execution based on the result of a complex expression. This is an advanced version of the standard If Action. When the statement is True, execution continues until an “EndIf” or “Else” Action is encountered. Otherwise, execution begins with the first line following the next “Else” (optional) or “EndIf” command.

Category:

Conditional

Syntax:

IfEx "expression"

expression

A basic expression consists of three elements - two items to be compared separated by a special operator. For example:


"item operator item"


The two items can be text, numbers, math expressions, variables, etc. The operator must be one of the following:


==

First item is equal to second item.

<

First item is less than second item.

>

First item is greater than second item.

!=

First item is not equal to second item.

<=

First item is less than or equal to second item.

>=

First item is greater than or equal to second item.

===

Exactly equal to (both the value and variable type match)

!==

Exactly not equal to


For example, the following expression compares the variable [City] to “Madrid” or to "Chicago":


IfEx [city] == "Madrid" or [city]=="Chicago"


To find out if [city] equals “Madrid” and another variable [name] also equals “John”:


IfEx [City] == "Madrid" and [Name] == "John"


For extremely complex statements you may want to use “(“ and “)” to make sure expressions are evaluated in the correct order.

Example:

IfEx [account] == "Guest" or ([account] == "Admin" and [name] == "John")
  GotoPage "Welcome"
Else
  AlertBox "Error!" "The account is incorrect." ""
EndIf


While

Purpose:

Repeat a series of Actions until a specified condition is no longer valid. Any Actions between the While and its matching EndWhile statement will continue to execute until the specified condition is no longer true.

Category:

Conditional

Syntax:

While "first item" "operator" "second item"

first item

The first item to compare. Can contain text, numbers, math expression, variables, etc.

operator


One of the following:


=

First item is equal to second item.

<

First item is less than second item.

>

First item is greater than second item.

!=

First item is not equal to second item.

<=

First item is less than or equal to second item.

>=

First item is greater than or equal to second item.

===

Exactly equal to (both the value and variable type match)

!==

Exactly not equal to

second item

The second item to compare. Can contain text, numbers, math expression, variables, etc.

Example:

In the following example, the variable [count] is increased from its iniatial value of 0 to 100, one by one.


SetVar [count] 0
While [count] < 100
  SetrVar [Count] [count]+1
EndWhile


WhileEx

Purpose:

Repeat a series of Actions until a specified condition is met. This is an advanced version of the standard While Action.

Category:

Conditional

Syntax:

WhileEx "expression"

expression

The expression to be evaluated. See IfEx for information about constructing expressions.

Example:

WhileEx [x] > 0 and [y] > 0

  SetVar [x] [x]-1

  SetVar [y] [y]-1

EndWhile


ExitWhile

Purpose:

Exit the current While/WhileEx/EndWhile block. Execution continues with the Action following the next EndWhile statement.

Category:

Conditional

Syntax:

ExitWhile

Example:

SetVar "[name]" ""
While [name] == ""
jsPrompt "Enter your name:" "" [name]
  If [name] == "Administrator"
    GotoPage "Setup"
    ExitWhile
  EndIf
EndWhile


Loop

Purpose:

Repeat a group of Actions a specified number of times.

Category:

Conditional

Syntax:

Loop "start value" "stop value" "variable counter"

start value

The starting value for the loop.

stop value

The ending value for the loop.

variable counter

The name of the variable to use as a counter. (Required)


Actions between the Loop and EndLoop statements will execute the number of times it takes to increment the counter variable from start to stop.

Example:

The following example reads and displays the first five lines of a file:


Loop 1 5 [counter]
  AlertBox "Current Loop" "[counter]" ""
EndLoop


ExitLoop

Purpose:

Exit the current Loop/EndLoop block. Execution continues with the Action following the next EndLoop statement.

Category:

Conditional

Syntax:

ExitLoop

Example:

Loop 1 100 [Count]
  Random 100 [r]
  If [r] > 75
    ExitLoop
  EndIf
EndLoop


   Wait

Purpose:

Postpone the execution of a group of actions for a specified number of milliseconds.

Category:

Conditional

Syntax:

Wait

Example:

Wait 1000
  AlertBox "Warning" "This message will show after one seocnd" ""
EndWait



   Return

Purpose:

Exit the current script or subroutine.

Category:

Conditional

Syntax:

Return

Example:

Return


   Refresh

Purpose:

Force the screen to redraw itself. Used to provide visual feedback during loops.

Category:

Conditional

Syntax:

Refresh

Example:

Refresh