Run Script
Run Script tasks are used to run scripts that typically perform some kind of processing on the job file received by the task. Scripts are often simpler to write than programs added with the External Program action (see External Program). However, they can be slower to execute.
The Run Script action task can be used either as an action or a condition. When dragging and dropping a Run Script action task on a given process, you select whether to use this task as an action or a condition from a contextual menu.
For more information on scripts, what languages are supported and how to write scripts and conditions, please see the related chapter, Using Scripts.
Input
Any data file, in any format.
Processing
The script is executed. The script can modify anything such as the data file, job infos, metadata, or even other files on the operating system.
Output
Whatever file the Run Script action generates, metadata it modifies or creates, etc.
Note about conditions: When using Run Script as a condition, the output of the task can be within the branch or on the main trunk. To control the output, use the Script.ReturnValue variable in your script.
Run Script action task properties are as follows:
The Script Editor menu options are as followed:
- File
- Import: Lets you open an existing script from an external file. This file can be in .vbs, .js, .pl or .py for language-specific scripts, or .txt for any of them.
- Export: Lets you save the current script as a file.
- Print: Prints the current script.
- Edit
- Undo: Undo the last edit.
- Cut: Cut the current selection (only available if there is selected text in the editor).
- Copy: Copy the current selection (only available if there is selected text in the editor).
- Paste: Paste the last selection that was cut or copied in the location of the cursor in the text editor.
- Delete: Delete the current selection (only available if there is selected text in the editor).
- Select All: Select all of the contents of the editor.
- Search
- Find: Brings up the Find dialog.
- Find Again: Repeats the previous search and finds the next occurrence.
- Replace: Brings up the Replace dialog.
- Go To Line: Brings up the Go To Line dialog where you can enter a line number and jump directly to that line.
- Language
- VBScript: Select if your script is written in VBScript.
- JavaScript: Select if your script is written in Javascript.
- Perl: Select if your script is written in Perl.
- Python: Select if your script is written in Pyton.
- Tools
- Help
- Contents and Indexes: Opens the Editor Help (this page)
The other options of the window are:
- The script editor text box: This is where you enter your XSLT Script that will be used. If you use an external script file, this will display the content of the file (note however that modifying the script in this case does not modify the external file and changes are not saved).
- Script running from: Choose if the script should be run from the editor text box, or from an external script file.
- Script filename and path: Either enter the full path of the XLST Script, or click the Browse button to navigate to the file. This option is only available if you choose external script file in the Script running from option.
With the Run Script action, the On Error tab is accessible by right-clicking on the action in your process and clicking Advanced Properties.
The On Error tab will be triggered if your script has an execution error (such as syntax error, etc) as well as when raising an error from wtihin your script. For more information, see
On Error Tab
By default, any action task, branch, splitter or condition that generates an error will simply be ignored, and the task just under it (not within a branch) will be given control of the job file without any modification. Any initial input task that generates an error will stop the process from running as a whole, and output tasks will not generate output. The On Error tab can be used to overwrite the default behaviors.
- Send to Process: Check this option to send the job file to an error management process.
- Error Process drop-down: Enabled only when the Send to Process option is checked. Lists any process of which the initial input task is the Input Error Bin task.
- Action Group: This group is disabled in the initial input tasks and defaults to Stop Process. In all other tasks where the On Error tab is present, the following options are available:
- Ignore: The task is ignored as if it did not exist, and the job file is passed on to the next task in the process.
- Stop Branch: If the task is in a branch of the process, the branch is stopped and the job file is returned to the process after the branch. The branch will not produce any output.
- Stop Process: The process is stopped and no more processing is done. No further output is produced.
- Log Message: Check this option to enable logging a custom error message in the PlanetPress Suite Workflow Tools' log file.
- Message: Enabled only when the Log Message option is checked. Enter a message that will be logged in the PlanetPress Suite Workflow Tools' log file. You can use any variables available in PlanetPress Workflow to customize the message.
- Store the message in variable: Select in which jobinfo, local or global variable you want to store the message content.
- ID: Enter an error ID. This ID will be visible in the Windows Event Viewer. However, the ID is not visible in the PlanetPress Suite Workflow Tools' log file.
- Store the ID in variable: Select in which jobinfo, local or global variable you want to store the error ID.
- Reset to defaults: Resets all options in this tab to their default values.
If storing the message or ID, if they are store in a jobinfo they will be available in any error handling process where errors are being forwarded. In all cases, if your process continues after the error, the contents of the variables selected in this window will be available for the rest of your process, or whenever they are overwritten.
Common Errors
Though some error messages are specific to a task in particular, others may apply to any and all tasks because they are related more to the system than to PlanetPress itself. Some examples would be W3813, W3830, W3991, W4005. These correspond to issues such as not having any space to write files, permission errors on folders or files, etc.
Comments Tab
The Comments tab, added in PlanetPress Suite 7.5, is common to all tasks. It contains a single text area (Task comments) that lets you write comments about the task. These comments are saved when the dialog is closed with the OK button, and are displayed in The Task Comments Pane.