Automating tasks : Recording and saving a script
 
Recording and saving a script
Scripts are particularly useful for tasks with many steps. Most actions you can perform in Corel PaintShop Pro are scriptable; however, be aware of the following guidelines:
You cannot script user interface customizations, CMYK profile creation or editing, operations inside the Manage workspace, operations inside of Print Layout, or gradient creation.
You cannot script the floating, docking, or arranging of toolbars, palettes, and windows.
You can script Materials palette and Mixer palette operations, as well as Tool Options palette selections, but you cannot record them. To script these actions, you must use a text editor application.
Only plug-ins that support scripting are scriptable.
Outside of the above restrictions, most actions you perform in Corel PaintShop Pro are scriptable.
Before you start recording a script, it’s a good idea to write down the specific actions you want to record. Ideally, your actions should be as efficient as possible.
Restricted and trusted scripts
The scripts in Corel PaintShop Pro are created in the Python programming language, which can unfortunately also be used to create and execute malicious scripts. Because of this potential danger, Corel PaintShop Pro includes two folders, automatically created in two locations during installation, each folder containing script files of distinct modes. These folders are
Scripts-Restricted — contains scripts that do not reside in a trusted folder
Scripts-Trusted — contains any trusted scripts
These folders reside inside the following paths:
32-bit — X:\Program Files (x86)\Corel\Corel PaintShop Pro X8\Languages\[language code] (where “x” indicates the drive on which you installed Corel PaintShop Pro)
64-bit — X:\Program Files\Corel\Corel PaintShop Pro X8 (64-bit)\Languages\[language code]
In your user folder, ...Documents\Corel PaintShop Pro\19.0
When you create and save a script for the first time, you’re directed to save the script in the appropriate path in ...Documents\Corel PaintShop Pro\19.0. After that, you’ll be directed to save to the most recently used folder.
When the application searches for scripts, restricted scripts are searched before trusted scripts.
Here are some considerations about restricted scripts:
If a script is run from an unconfigured path, it is treated as restricted.
If a path appears in both the restricted and trusted lists, it is treated as restricted.
Presets, Material palette swatches, and Print Layout templates (which are essentially scripts) are treated as restricted.
Commands that cannot be used in a restricted script
Some commands cannot be run from a script stored in the Scripts-Restricted folder. The table below lists a number of these commands. If you want to run a script that contains any of these commands, you must move it to the Scripts-Trusted folder.
 
Command
Menu location
FileSave
File Save
FileSaveAs
File Save As
FileSaveCopyAs
File Save Copy As
GIFExport
File Export GIF Optimizer
PNGExport
File Export PNG Optimizer
JPEGExport
File Export JPEG Optimizer
FileLocations
File Preferences File Locations
FileClose
File Close
FileCloseAll
File Close All
FileSend
File Send
BatchConvert
File Batch Process
BatchRename
File Batch Rename
Mapper
File Export Image Mapper
Slicer
File Export Image Slicer
FileExit
File Exit
To record and save a script
Edit workspace 
1 Click the Start Script Recording button .
2 Perform the actions that comprise the script.
3 Click the Save Script Recording button .
The Save As dialog box appears.
4 Choose the folder where you want to store the script.
5 Type a name for the script, and click Save.
 
You can also
 
Remove any undone commands from a script
In the Save As dialog box, mark the Remove Undone Commands check box.
Save Materials palette settings used by actions with a tool in a script
In the Save As dialog box, mark the Save Materials check box. If this check box is cleared, the current material is used with the given tool when the script is run, rather than the material that was used when the script was recorded. This option only applies to recorded actions with a tool, not with a material setting in a dialog box.
Display interactive dialog boxes in their position during recording
In the Save As dialog box, mark the Save Dialog Positions check box. You may not want to use this option if you intend to share the script with others. Enabling this check box not only records the dialog position, but whether the Before/After preview area is displayed, whether the dialog is maximized, and whether the Preview on Image check box is marked. You can leave these preferences up to other users of your script.
Add descriptive information to a script
In the Save As dialog box, click Description, and type information in the Author, Copyright, and Description boxes. The information you enter is displayed when you edit the script.