Basic Scripting

How to prepare for scripting, recording a script,
running the script and making simple script modifications.

A PSP 8 Tutorial for May 15, 2003

[ PSP index ] [ Composite Index ] [ PSP Links ] [ 3D Bits n Pieces ] [ Tutorial CD ]

In today's tutorial we discuss very basic scripting and make our own script to help process a group of photos needing the same image adjustments and sharpening fixes.

Scripting is nothing more than automation of commands in PSP using a special scripting language called python.

Do you have to "learn" the scripting language to use the feature in PSP8?

No! Creating and using a script is as simple as pushing a record button and then going through the steps you want to replay on another imaget and saving it.

Even editing the script is easy! Press the edit button and make choices in check boxes and drop down boxes.

Anyone can learn basic scripting in a few minutes.

Let's figure out how to do the following. Turn on and understand the Scripting Toolbar, Add a button to the Layer palette, Set up for scripting, recording a script, running the script and editing the script.

The Scripting ToolBar:

 

 

 

Make sure the Script Toolbar is visible in PSP.

To turn it on, go to View > Toolbars > Script from PSP8's Menu Bar.

The Toolbar appears on the bar under the Menu Bar at the top of the screen.

If there is another toolbar in the way, such as the photo toolbar, grab the script toolbar by the left handle (vertical striped bar) and pull it onto the interface (undock it). We need to see all the buttons.

Please note: Any toolbar can be docked on any of the 4 sides of the interface. Drag the tool bar around until it docks and see where you like it.

Off the subject, but I like the new property bar docked at the bottom of the screen rather than at the top.

With the Script toolbar visible, lets go over the areas of it.

Refering to the image above:

The left white box shows the currently selected script. Use the drop down box to select another premade script. (1)

At your leisure, try out the premade scripts and run them. Be brave.

The Run Selected Script button, (Play) is next to the script name box. (2)

Next to the play button is the Edit Script button. Pressing this icon brings up PSP's internal editor for currently selected script. We will go over that later. (3)

The next icon toggles interactive scripting, which we will use in a bit. (4)

To the left is the Run Script button actually used for loading a script from the harddrive. (5) I call it load script.

The circle with the X through it is the stop (playing) script button, (6)

The blue circle is the record button (7)

The icon with two vertical bars is Pause (recording) button,. (8)

X means stop script (recording) (9)

The last button on the right is the Save script icon. (10)

Pretty simple huh? If you can run a tape recorder, or VCR, these buttons should look very familiar.

Part 1: Preparing to script


Open Paint Shop Pro 8. Clicking on the image on the left here then saving the bigger image to your drive, then opening in PSP8.

A quick look at Sago.jpg shows it's too dark and dull and needs sharpening. Let's assume all the images we plan on adjusting have the same problems.

Before recording our script, apply the adjustments work out the steps.

Open the layer palette if it's not visible, by going to View on the Menu Bar, then Palettes > Layer Palette.

Or, press F8 on the keyboard. (This is WAY different than PSP 7 where all you did was press L on the keyboard!)

Dock the palette on the right by dragging it to the right side of the interface. Or not, as you like.

Run the mouse over the icons at the top of the layer palette noticing what they are.

From the left: New Raster, New Vector, New Mask, New group, Duplicate and Delete, blah blah blah.

What's missing on my layer palette is New Adjustment layer!!! Here we wade off the subject again...

Since PSP8 is so customizable, we can add icons and functions to the Layer palette to suit how we work. :)

Lets add "Levels" icon to the Palette so we can call up a new Levels Adjustment Layer quickly.


Right click the Layer Palette's title bar or icon bar.

Choose customize from the flyout box.

Pull the Customize dialog box away from the layer palette so you can see both.

Make sure the Commands tab is selected on the top of Customize box.

Move down categories on the left panel and click on Layers to select it.

Notice how the commands in the right panel change show only the ones pertaining to Layers.

Use the scroll bar on the right of right panel to move down until Levels shows in the box.

Click and drag the Levels Icon to the Layer palette.

Drop it after the first icon on the left, (New Raster.) Or drop it where you want it.

It's that easy!

To remove that icon or any other from a Toolbar.

Open the customize dialog box, grab the icon on the palette, drag it off the palette.


It will be GONE!

Click the icon on the layer palette for new Levels layer and make the following adjustments on the dialog box.

Move the right hand highlight slider left till the value reads about 190.

Move the midtone slider to the left till its value reads about 1.11.

Press OK to apply the levels layer. :)

Jot down the values you chose for later.

Hint: If you don't want to jot them down, press the save button at the top of the Levels layer, type in a new name and you can recall these settings another time. But that's for another tutorial.

 

Have PSP to resize the image to 50 percent.

Go to Image on the Menu Bar then Resize from the flyout box.

The Resize Box has changed from PSP7.

( I am not so sure I like it, but that's beside the point. I will adjust soon. So will you.)

In the Pixel Dimension box, be sure Percent is shown on the box at the right.

Enter 50 percent in the width box.

The new pixel size shows up next to the words Pixel Dimensions.

Leave the other values at their defaults and press OK.

Finally, sharpen this image.

Make sure the background layer is selected on the layer palette cause you cain't sharpen the adjustment layer. LOL

Go to Adjust on the Menu Bar and Sharpen, Unsharp Mask.


Notice the sharpen command is no longer under Effects, but under Adjust.

Set the following on the Unsharp Mask box. Radius 1, Strenght 150, Clipping 1.

I would suggest saving your favorite sharpen settings by pressing the save icon on the top of the box and naming your new preset.

It will then be available to you when you need these same settings.

REALLY SAVES TIME!

Press OK.

 

 

 

Coax PSP into saving this image to the hard drive in the Jpg format.

Go to File>Export on the Menu Bar and pick JPEG optimiser.

 

Set the compression value to about 25 for this exercise and leave the other stuff alone.

Notice I saved my preset calling it Normal 25 Comp. ;)

Press OK.

On the Save Copy As dialog box, type in Sago400 and press OK.

Your image should look a bit like mine.

 

Go to Edit, Command History, select the first command and press UNDO to go back to the original image.

 

 

 

Or, just press CTRL+Z to till it's back to where we started.

Part 2: Recording a Script:

On the Script Tool Bar, press the Start recording button, the blue circle icon.

From here on EVERYTHING you do to the image is recorded. That's why we went through the adjust process before hand to slickify our moves.

1. Add the Levels Adjustment layer moving the sliders to 190 for the highlights and 1.11 for the midtones. Press OK.

2. Go to Image > Resize and do the 50 percent thing. (Should be set up as it was last time)

3. Select the background layer on the layer palette.

4. Do the Adjust Sharpness Unsharp Mask using the settings of 1, 150, 1 as before.

5. Go to File, Export, JPEG Optimiser. Use the same settings of 25 percent. Then Ok, then give the file a new name and press Ok.

Press the Save Script button on the scripting toolbar.

On the Save As dialog box, use the navigator to browse up to the PSP8 Folder and find the Trusted Scripts folder.

Double click to open that folder.

 

 

Name your script LevelsJpg making sure the type is a Script File with the extension .PspScript.

Press Save.

Your script is recorded for future use! :)

Part 3: Running the script and Editing where necessary.

 

On Sago.jpg, Press Undo or use the Command History to undo all your commands to the image.

On the scripting Toolbar, use the drop down arrow next the the Script name and find the script you just made.

Select it and it shows up in the Script Name Box.

For this exercise, make sure the Interactive Script button, the one with two like bullet things on it is toggled ON.
Press the Play button next to the name to run the script on the image.

Up pops the Levels box. ugh. We want this to run itself.... Press cancel on the levels box. The press NO on the Message box that asks if you want to continue the script.

To make the script run without any help from you.. toggle OFF the Interactive script button and Play the script again. It runs through by itself.

BUT if you run this on another image can you guess what will happen? It will save the image as Sago1.jpg or whatever you named the image in the script. ARRGGHH...

Let's fix this up and make part of our script interactive.

With the levelsJpg showing in the selected script name box, press the Edit Script button. (Scroll with Pen Icon).

Notice in the script commands box, near the bottom, each command has a check box with a check and a word in the box next to the check.

Twirl down the arrow next to default at the Level line.

Cchange it to Silent. Change Resize to Silent, Unsharp Mask to Silent and change JPG optimiser to Interactive.

Then press Save.

Make sure the Interactive Script button is depressed, toggled on the Scripting ToolBar.
On the sago.jpg image, make sure the image is back to the original look. Press the Play button next to the LevelsJpg script again.

Notice that, like lightning, the steps of the script run through until the JPG optimiser comes up. Now you can Press Ok and name the file accordingly.

And that's it for the sago image.

Part Three: Using the script on other images.

Close Sago.jpg without saving and open Brugmansia.jpg and PhoenixBloom.jpg

Run the Script, LevelsJpg, on the Brugmansia, image. Name it Brugmansia1.jpg on the interactive JPEG optimiser window.

Run the Script on PhoenixBloom as well. Name it PhoenixBloom1 on the JPEG optimiser. :D

Close both images in PSP8 without saving.

See how quickly and easily the script helps you process images?

Your assignment for next week is to write your own simple script to share with the class.

It can be as simple as applying two different levels of Unsharp Masking or adding a Title to an image.

Go for it! The best way to learn a new feature is to use it and abuse it. Make it yours!

[ PSP index ] [ Composite Index ] [ PSP Links ] [ 3D Bits n Pieces ] [ Tutorial CD ]

All Tutorials and Tips including images and text
Copyright 2003 3D Workshop, Inc.

Further distribution prohibited without express permission.
For information e-mail is in image below