The SCRIPT command is available to all protocols for executing JavaScripts within an action. The SCRIPT command is similar to the existing SYSTEM command and shares the same macro values. The SCRIPT command (along with other select action commands, e.g. LCOPY) is available for use with existing ExecuteOn functionality if preceded by a $
(for example, $SCRIPT
).
JavaScript files (normally .js extension) will be compiled into Java classes as needed. A file’s last modified time will be used for indicating the file has changed and needs to be recompiled. The VersaLex application uses Rhino ( http://www.mozilla.org/rhino ), which is an open source, pure Java, JavaScript engine to interpret and compile JavaScript source files into Java classes for execution. See https://developer.mozilla.org/en/Rhino_JavaScript_Compiler.
Refer to the API javadocs for examples and a description of the methods and functions available from within JavaScript (refer specifically to the ISessionScript class javadoc). The methods include the ability to run other action commands within JavaScript and writing to debug or the system log. These methods, when combined with JavaScript, make it possible to have complex sequences or decisions that would not be possible using action commands alone.
SCRIPT command dialog
The Edit Command dialog for the SCRIPT command is similar to the SYSTEM command dialogs. See SCRIPT command reference for a description of the HALT
parameter and command syntax.
SCRIPT command reference
The SCRIPT command has the following syntax:
SCRIPT [-HALT] [SuccessCodes=…] "scriptFilename" ["argument"... ]
-HALT
- Stop the script execution when a service/daemon is requested. When not specified, the service/daemon may not shutdown until the script has finished executing.
[SuccessCodes=…]
- For the SCRIPT commands, VersaLex allows you to define integer value exit codes to consider successful. To define these codes, the optional parameter,
[SuccessCodes=...]
, must precede the command string. The values specified are the exit codes (and code ranges) your application considers to be successful. Within the list, use commas to separate codes and code ranges (low to high). By default, either zero or undefined (no return code) are considered successful. "scriptFilename"
- Local source path to the JavaScript file to execute.
"[argument]"
- Optional argument(s) to pass to the script. Macro variables are supported. See Using Macro Variables (SYSTEM and SCRIPT Command context) for a list of the applicable macros.
Comments
0 comments
Please sign in to leave a comment.