Alertra Script Language 1.9

if

Conditionally perform a statement. If the expression evaluates to anything besides "0", the statement will be executed. If the expression evaluates to "0" the statement will not be executed. Use of the keyword 'not' reverses this behavior.

Normally you would branch using a goto statement, but you can use any valid statement after the then clause. Additionally, you can have multiple statements executed by separating them with a semicolon (;).

You can use the 'begin' keyword in place of the statement to execute multiple commands. Be sure to terminate the if with an 'end' statement:

	if not "My web site" in $CONTENT then begin
		....
	end

usage: if [not] [expr] then [statement] [;] [statement...]

parameters:

req name type description
N not literal Include this literal to negate the value of the expression.
Y expr expression The expression to be evaluated.
Y statement statement The command(s) to execute if the expression evaluates to true.

examples

if "Login Successful" in $CONTENT then goto success

If the variable $CONTENT (which always contains the result from the last protocol command) contains the text "Login Successful" the script will branch to the label ":success". Otherwise the script will continue with the next statment after the if.

if not "Login Successful" in $CONTENT then error "Login to site was unsuccessful"

If "Login Successful" is not in $CONTENT, then the script will be terminated with an error message ("Login to site was unsuccessful"). Otherwise, the script will continue with the next statement after the if.


Alertra Script Language: Language Reference