How to Write Your Own Scripts

by Sigrid, Co-Owner of EZ Tagging



Part 1 - Python and Other Basic Information

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



What you need to know about Programming

To write your own scripts you will need some basic programming skills. This means you should at least know the meaning of

Variable, Constant, Function, Loop, If-Else-Loop, Comment

and other such basic things about programming. If you have never used Visual Basic, Pascal, Java, C++ or any other programming language then you should probably be content to use scripts and don't try to write any of your own.


What you need to know about Python

PYTHON is the language in which a PSP-script is written. It is a programming language with some pre-defined functions.

Paint Shop Pro itself uses the language in many functions like the Presets or the Brushes.

The most important thing you need to know about this language is that it is case sensitive.
This means a variable named temp is different from a variable named Temp or TEMP.

Also, the level you are on is defined in Python by blanks. This means you have to be very careful with all spaces at the beginning of the line.

Those are also the most common errors that are made when editing a script.
And you will always have a problem with them even if you have written some scripts already. So don't get frustrated about it and don't panic. PSP usually catches the error immediately and you cannot harm the program with a script.


Recording a Script

For the purpose of this tutorial we will record a simple script that will rename layers and asks the user for the new layer name. You can download a multi-layer pspimage (MultiLayer.pspimage) or you can simply take one of your own. It should have at least four layers. Make sure your Layers palette is visible (View->Palettes->Layers).



~~~~~~~~~~~~~~~~

Back Next

~~~~~~~~~~~~~~~~

EZ Tagging

~~~~~~~~~~~~~~~~



This tutorial was written by Sigrid
Any similarities to other tutorials is merely a coincidence.
~All rights reserved - 2012~