Extended Commands |
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.