7.5

Table Of Contents
ExecScriptFile (function)
Allows PlanetPress Design documents to execute the content of an external script file. The document waits until the script has
completed before resuming its own execution.
Note: This function does not support printer centric mode; results are undefined.
Syntax
ExecScriptFile(filename: string, parameters: string, scriptlanguage: integer) integer
Arguments
filename
Fully qualified path and name of the script to call and execute.
parameters
User-defined string value allowing a document to pass additional information to the script, such as data selections, PlanetPress
Talk variables, etc..
scriptlanguage
The programming language in which the script is written. The valid values are:
0 Auto-detect based on file extension: VBScript (.vbs) | JavaScript (.js) | Perl (.pl) | Python (.py)
1 VBScript
2 JavaScript
3 Perl
4 Python
Return value
Successful execution of the external script file will return 0 by default, although this value may be set by users through the
"Script (system object)" (page 249) system variable. Note that some negative values are internally used to indicate different
types of failure, always using negative values, which means conflicts may happen when users set the Script.ReturnValue var-
iable with an existing negative value. The proper practice is thus to return only positive values.
Here are the existing negative values:
-1 Script file does not exist or is not accessible.
-2 Invalid script language.
-3 Error during script execution.
Use of PlanetPress APIs within called scripts
When a script is called from within PlanetPress Design using ExecScriptFile(), all of the PlanetPress environment is available to
the script, including the Watch, Metadata, Capture and Alambic objects.
Using these objects from a script within a Design document is not supported and can lead to unexpected results. Fur-
thermore, setting a Watch variable or job info from within the script will not return this value to the document, as
these values are always passed once when the document is called, never during execution.
Accessing Parameters from the script
©2010 Objectif Lune Inc - 486 -