Sometimes a script needs to repeat itself or skip a section. This is done with the GOTO statement. It requires two statements.
First, a line must be named. This is done by starting the line with an @ sign, and continuing with a name. Then the GOTO statement is simply GOTO name.
GOTO scriptend
:
: This code will be skipped
:
@scriptend
The GOTO statement is usually used with an IF.
DEFINE GENSTATUS 1FFDC [B1]
@CHECKGEN
MAKE [GENSTATUS != N/D] BYSENDING EAFF DC FF 01 FF FF FF FF FF
IF [GENSTATUS == 0] {GOTO GEN_IS_OFF}
IF [GENSTATUS == 3] {GOTO GEN_IS_RUNNING}
IF [GENSTATUS == 5] {GOTO GEN_IS_FAULT}
WAIT 5
GOTO CHECKGEN
@GEN_IS_OFF
"Generator is Off.
GOTO SCRIPTEND
@GEN_IS_RUNNING
"Generator is Running.
GOTO SCRIPTEND
@GEN_IS_FAULT
"Generator is Faulting.
GOTO SCRIPTEND
@SCRIPTEND
The LOOP command is used to restart a script from scratch. It is not quite the same as a GOTO, in that the LOOP command clears the Monitor and Progress windows. It essentially is the equivalent of the user clicking the "Run Again" button.
The ABORT command ends the script. It also displays a message, if desired. This is typically used in an IF statement.
IF [MINVERSION != 1.00.28] {ABORT "Requires Omniscope 1.00.28 or more recent."}
The EXECUTE command allows the script to start another program. The syntax is EXECUTE "program" paramaters
DEFINE GENSTATUS 1FFDC [B1]
MAKE [GENSTATUS != N/D] BYSENDING EAFF DC FF 01 FF FF FF FF FF
:if genset in fault mode, start the troubleshooting program
IF [GENSTATUS == 5] {EXECUTE "GensetTroubleshooter.exe"}
The EXECUTE command cannot trigger the execution of another script, only a Windows program.