SElib.interpret()
syntax: |
SElib.interpret(codeToInterpret[, howToInterpret[, security]]) |
where: |
codeToInterpret - a string with ScriptEase code statements to be interpreted as script statements or the file specification, path and file name, of a script file. If the interpreted code receives arguments, they are put at the end of the codeToInterpret string--somewhat like a command line string.
howToInterpret - tells how to handle the interpreted code. The following flag values may be combined using the bitwise or operator, "|". The value must be 0 or one of the following choices:
• INTERP_FILE • INTERP_TEXT • INTERP_LOAD • INTERP_NOINHERIT_LOCAL • INTERP_NOINHERIT_GLOBAL • INTERP_COMPILED_SCRIPT
INTERP_FILE and INTERP_TEXT are mutually exclusive. If neither is supplied the interpreter decides whether codeToInterpret is a file or string of code.
These flags tell the computer how to interpret the parameter codeToInterpret. If one is not supplied, the computer parses the string and determines the most appropriate way to interpret it.
security – the filename of the security script to run this interpreted script using. This is exactly like the security script passed to SEdesk using the "/secure="option, except it applies only to the script you are about to interpret. Remember that security is additive; any existing security is still in effect for the interpreted script as well.
|
return: |
value - the return of the interpreted code.
|
description: |
Interprets a string as if it were script. More flexible than the JavaScript global.eval() function since it interprets a file as well as a string and allows more control over how interpreted code inherits variables from the script that calls SElib.interpret(). By default, all variables in a script are inherited as global variables.
There is no specific return for an error. To trap an error use the try/catch error trapping statements.
The SElib.interpret() method may not be used with scripts that have been compiled into executable files using the /bind option of the Pro version of ScriptEase Desktop.
|
see: |
SElib.interpretInNewThread(), SElib.spawn()
|
example: |
// The following interpreted code displays "Hello world" SElib.interpret('Screen.writeln("Hello world")', INTERP_TEXT); // The following interprets // the file jseedit.jse with // autoexec.bat as an argument to the script SElib.interpret("jseedit.jse c:\\autoexec.bat", INTERP_FILE); |