Copyright © 2009 warpedeggs.info Running A Script


Before creating your own scripts, you should learn how to run scripts created by others. This lesson will cover the components of the Script Toolbar and explain how to select and run a script.
The Script Toolbar   section divider

The Script Toolbar contains the icons you need to select, record, save and run PSP scripts. It may already be visible in your workspace. If not, select View/Toolbars/Script to display it. The toolbar can be left floating or it can be docked to your workspace. Your toolbar should look similar to the one below.
Move your cursor over the Script toolbar below for component descriptions.
Script Toolbar
Currently Selected Script View Script Dropdown List Run Selected Script Edit Selected Script Toggle Execution Mode Script Single Step Clear Script Output Run Script Stop Script Start Script Recording Pause Script Recording Cancel Script Recording Save Script Recording Your toolbar should contain at least the Run Selected Script, Edit Selected Script, Stop Script, Start Script Recording, Cancel Script Recording and Save Script Recording icons before you begin to run and record scripts. If these are not present on the toolbar, you will need to use the Customize dialog to add these icons. View/Customize opens the Customize Dialog. Locate the missing commands and drag them onto the Script toolbar.
Scripting Safety   section divider

Before running scripts, let's take a minute to discuss safety. A web search should convince you that there are lots ot scripts available for download. Before you decide to try one, remember that anything you download or install on your computer has the potential to harm it. Scripts are no exception. So exercise the same precautions that you would with any download. Using a trusted source is particularly important, if you haven't yet developed the skills needed to read and understand what a script does.

PSP helps to provide safeguards for you too. Your PSP Files directory has two script folders: Scripts-Trusted and Scripts-Restricted. Scripts that are placed in your Scripts-Restricted folder or subfolders will be restricted from taking actions that could delete or change files on your computer. This restriction will also be applied to scripts run from other locations on your computer using the RunScript button.
RunScript Icon
Scripts placed in the Scripts-Trusted folder or sub-folders are allowed to access files on your PC. There are valid reasons for allowing this access. Batch operations that process and save images are one example. Many imports of special Python functionality also require that the script be placed in a Trusted folder. Documentation for a script should tell you if it needs to be placed in the Trusted folder. Again, don't run scripts in the Trusted folder unless you are confident in the script source and understand what the script will do.

Running Scripts   section divider

A number of scripts, Restricted and Trusted, are included with your PSP installation. They provide a variety of functions and are a great way to begin learning about scripts. Let's run one.


Open a new image, 400x400px with a transparent background or color of your choice.

Add a new layer, and put a picture tube near a corner of the image.  Show Step Example

Click on the Script toolbar dropdown list.  Show Step Example

Select Scripts-Restricted from the Category dropdown list  Show Step Example

Select the CenterLayer script.  Show Step Example

Click the RunSelectedScript icon  Show Step Example

Show Step Example


Your picture tube should now be centered on it's layer. The script mimics the Center In Canvas command for vector layers, but it works for both vector and raster layers.

Let's try one more. You can use the image that you made for the CenterLayer exercise.



Open the dropdown list again, change the Category to Scripts-Trusted and select the GridByCells script.  Show Step Example

Click the RunSelectedScript button.  Show Step Example

A "Define Cells" dialog box will appear.  Show Step Example

You can accept the 3x3 default or make a change, Then Click OK.  Show Step Example

Your image will be divided with the gridlines that you specified.  Show Step Example

Note: The script turns on the grid feature, if it isn't currently on. Use View/Grid to turn it off again. If the grid feature was already on, the script will only change the grid settings for the selected image.
Show Step Example


This is an example of a script that needs to be placed in the Scripts-Trusted folder, because it uses special imported functionality. In this case, the functionality is the dialog box that prompts for the number of cells. Although PSP has some built-in dialog boxes that don't require this functionality, this type of dialog box can be very useful when you wish to gather several pieces of information at one time. You won't learn to script this type of dialog box in this class, but it will be introduced at an advanced scripting level. You may, however, encounter it when running other scripts.



Assignment   section divider

  • Read the lesson carefully.
  • Run the scripts shown in the examples
  • Make a note of any questions you may have about the lesson or examples.
  • Visit which provides documentation on the scripts that are included with PSP (those in the "PSP Bundled" categories).
  • Try running a few scripts that you read about.
  • Create a basic html page and tell about at least two scripts that you tried. Include your own Before and After pictures.
  • Leave a comment: share any questions that you had and include a link to your html page
  • Check out questions and pages from other folks comments

Valid XHTML 1.0 Valid CSS