This tutorial was
written by Amber Howard on April 23, 2015. Any resemblances to other tutorials
are completely coincidental. Scripting and translating of this tutorial is
forbidden. Do not copy and paste this tutorial anywhere else on the internet. Please
link back to the main blog instead.
Today
we are going to be doing a different sort of tutorial than normal. Susan over
at CDO expressed interest in learning how to script tags, and thus this
tutorial was born. Scripting tags saves taggers a lot of time, and a lot of
pain from having to go through the repeated motions of adding names and effects
to their tags. It is by no means an easy way out, but is merely a time saving
tool. I will be writing this tutorial today to walk you through the steps of scripting
from setup to completion of a tag. Please be aware that this is how I
personally script, and there may be other options and methods available. Once
you understand the basics, it is pretty easy to create your own method of
scripting.
So
please, get a drink, and settle in and have a little bit of patience because
this is going to be a long one.
To
begin, you will need a copy of PaintShop Pro. I used PSP X7, but any form of
the program will do for tags that will be saved in the .JPG or .PNG format. I
will make another tutorial on how to do animated tags in the .GIF format
another day.
Next,
you will need a copy of the TJP-MakeTags main script file by Julie Stenning,
which can be downloaded here. This is the most widely used script file for
scripting tags, and is very easy to use once the system has been run through a
few times and becomes somewhat of a normal process. There are several Yahoo
groups out there that can help with scripting as well, please feel free to
check them out. The most popular group is Scripting 101, which offers help and
tutorials similar to the one that I am writing for you today.
Now,
before we even begin making a tag, we should set up our folder structure for
scripting. For ease of location and not using too many resources on your
computer or pushing your PSP program to its limits, it is easier to have most
(if not all) of the required folders in one location. The easiest location to
remember is in your PSP documents folder.
Depending
on which version of the program you are running, it could be listed in a few
different ways, but it will always be in your My Documents folder. Newer
versions of PSP have the folders we are looking for within the folder tree of
My Documents/Corel PaintShop Pro/PSP#/. So, for example if you are running the
X7 version of PSP, the tree would look like this: My Documents/Corel PaintShop
Pro/17.0/.
Older
versions may be contained in My Documents/My PSP Files. Either way you are
looking for the folders titled Scripts-Restricted and Scripts-Trusted. These
two folders are going to be the life-line of your scripts. The magic will
happen almost entirely within these folders, which is why it is easiest to do
the pre-tag setup in these locations.
For
now, we are going to focus on the Scripts-Trusted folder. When this folder is
opened, it should be completely empty if you haven’t scripted before. This is a
good thing. Once in this location, you are going to want to create two new
folders by either clicking the New Folder button on the top of Windows Explorer,
or by right clicking in the blank space and then choosing New/Folder from the
menu that appears.
The
first folder that you are going to want to create should be titled Scripts.
This is where the main script file for each tag that you are going to make will
be held. It will keep all of your main scripts together in one easy to locate
and easy to edit location, which will help once we actually go to start setting
up the main script files.
The
second folder that you are going to want to create should be titled Tags. This
is where the blank tags that you make will be held. Again, it will keep them
all in one easy to locate and edit location which will help for the general
ease of scripting once we get to setting up the main script file.
Once
you have the two new folders created, you are going to want to create a .txt
file within the Scripts-Trusted folder. This file will contain the list of
names that you wish to be scripted onto your tag. The easiest way to create one
of these files is to right click in the blank space of the folder and then
choose New/Text Document from the menu that appears. When it comes to the list
of names that you are writing out, there are only a few rules to remember:
1. All
names must be located on their own line. If you create a listing of names on
the same line, with commas to separate them, the script will read it as one
name instead of many names. The basic setup for a name list would look
something like this:
Name
One
Name
Two
Name
Three.
2. Spaces
are allowed and there are no limits to the number of characters that a name can
have. The only limitation comes from the font and font size that you use on the
tag. So remember to make sure that your name list is compatible with the font
you choose and the space you have to work with. JoBobEllaRulZ! would look great
on a tag, but if there isn’t enough space for it to fit, and the font doesn’t
support special characters then the results may not be as pretty as you are
intending them to be.
3. There
are no limits to the number of names that you can put on your list. As long as
there is something there, the script will run. One name, fifty names, two
hundred names, the length of the list is up to you and your computer. Please be
aware that overly long scripts can make your PSP program crash!
The
last folder that you will create is a folder to house the completed tags once
the main script file has been run. I usually save this file to my Desktop, so
that PSP does not get it confused with the other files. It can be placed
anywhere on your computer, I do believe, but the Desktop is usually the easiest
to locate and remember.
When
your file structure setup is complete, we can then move on to the actual
scripting process. The above steps will not change no matter how many tags
scripts you write. Once you have completed the above, you are done with those
steps entirely, unless you wish to add or remove names from your list. The
below processes will be the ones that are repeated for each script, so if you
need a break, take one.
Back?
Okay, good.
A
good rule of thumb when it comes to scripting is to make sure that your Scripts
palette in PSP is always available to you. If you cannot see it on your screen,
make sure to go to View-Toolbars-Script and move the newly visible palette to a
spot on your window to anchor it there. Mine is set up to look like the image
below, and I have circled the Script palette in red. Depending on your version
of PSP, it may look different when it comes to the shape/color of the buttons,
but nearly all of the Script palettes are the same when it comes to the layout.
First
you have the drop down menu that allows you to choose the script file that you
wish to run. Ignore this for now. Then, usually, you will have the Run Selected
Script button, the Run Multiple Scripts button, the Edit Selected Script button
(which I will talk more about later), the Toggle Execution Mode button, the Run
Script button, and then the Stop Script, Start Script Recording, Pause Script,
Cancel Script Recording, and Save Script Recording Buttons.
Out
of this huge list of buttons, the ones to familiarize yourself with are the
drop down menu, the Run Selected Script, Edit Selected Script, Start Script
Recording, Cancel Script Recording and Save Script Recording buttons. They are
the ones that you will use the most.
Once
you have completed your tag with its frames and elements and what have you in
place and you have cropped away excess canvas, merge all of the layers together
into one layer. This includes your copyright information, as well. DO
NOT add the text for your name to this merged layer!! In this you
are effectively creating what is called a “blank,” which is a completely
finished tag with no name on it. Save this file as a .pspimage into your
Scripts-Trusted/Tags folder. DO NOT
share this file with anyone as it is against every company’s TOU to do so!
Now
it is time to add your name to your tag. The easiest way to go about making
sure that you have enough space for all of the names on your list is to use the
longest name on your list as the script creator. So, for example, if you have a
list of names that include Amber, Kelly, Susan, and JoBobEllaRulZ! on it, then
when you type out your name on your tag, you will use JoBobEllaRulZ! since it
is the longest. DO NOT convert to raster layer just yet.
Make
sure you are happy with the font that you’ve chosen, the color, the placement,
everything about the name. Make doubly sure that if there are any letters like
‘y, g, or q’ that hang down that they won’t be hanging off canvas, and that
none of your names are too close to any of the edges of the canvas. If you’re
done with your name layer, then get ready to create your first required script.
In the Script palette, click on the Start Script Recording button. From that
point until you save the script, everything that you do in PSP will be
recorded, which is why it is a good rule of thumb to make sure everything is
settled before you record. What does this specific script record for you? The
font you used, the size of the font, the color of the font, and the placement
of the font.
Once
you have hit the Start Script Recording button, make sure your text tool is
active, and edit your name layer. Retype the name out once more, and then apply
the text, and convert to raster layer. If you are going to make sure that the
name you put on the tag is centered, do so before converting the text to raster
by going to Objects – Align – Center Horizontally/Vertically, what have you. Then
you can convert it to raster layer. This will make sure that when you run the
final script that the centering does not throw off your effects script and make
it faulty.
When
you are done with that, click the Save Script Recording button. It will pop
open a new window in which you choose the name of your script and where it is
placed. Make sure that this text script goes into your Scripts-Restricted
folder for proper use by the program. Also make sure to name the script
properly. For example, if the tag you are creating has the name of PUTTAG1, a
good rule of thumb to follow would be to name the text script ‘puttag1text’ so
that you can differentiate from the other scripts in your file.
Now,
your text script is almost done! Choose the script that you just made from the
drop down menu on your Script palette, and then click the Edit Selected Script
button. This will pop open another menu that looks like this:
I
have circled the button you will want to hit in red. The Text Editor button
will pop open Notepad on your computer so that you can edit the script that you
just made. In this new file there are only two things that we need to change.
Read through the document (it isn’t very far down) to locate the def
Do(Environment) : tag within your script. Hit enter once and then place the
following text in the new lines that you have created with the exact spacing as
in the example picture to follow:
Results = App.Do(Environment,
'ReturnLayerProperties')
TagName = Results['General']['Name']
Once
you have done that, continue to scroll down your document. You’ll be able to
see the font name that you used, the font size, and a bunch of scripting. The
part of the document that you are going to be looking for is under the
Characters setting. It will be noticed easily as it has the name that you typed
out when you created the script. As you can see by the example below, I speak
fluent typo-ese. Now, you will want to change this string to the following: 'Characters':
TagName,. This will force the script to read the list of names that you wrote
out earlier and run those names instead of scripting the characters previously
written in the script.
Save
and you are done with the first required script! You can close this file now,
and return to PSP. It is now time to write out your effects script. A good rule
of thumb would be to actually run yourself through creating the effects first
so you know what you are doing, write them down or remember them, erase all of
the effects, and THEN write your script so there are no mistakes. Remember,
once you hit the Start Script Recording button, PSP will record everything that
you do in the program.
Once
you are confident in how the effects look, return to a normal raster layer and
prepare yourself to write your effect script. Hit Start Script Recording, and
then carefully repeat all of the effects that you are going to create. The
script will record each plugin and effect that you use, remember the exact
settings that you used, and in which order you placed the effect.
Good
rule of thumb: Once you’re done with the effects, remember to Merge Visible. If
you forget this step, then the script will cause your PSP to crash when you run
it to save as .PNG files, since they are single layer files. It will not crash
if you save as .JPG files, but it is a good process to get in the habit of
making for .PNGs.
Finished
with your effect writing? Click the Save Script Recording button, and save once
again to the Scripts-Restricted folder. Again, make sure the name that you save
as reflects the tag you are making. For example, since we are working on the
PUTTAG1 blank, then the script recording would be saved as puttag1effs. Or
something similar.
Like
before, we have a little bit of editing to do in the created script file.
Choose the new script from the drop down menu and then click the Edit Selected
Script button. It will either pop up the same menu as before where you click
the Text Editor button, or it will pop open a Notepad document for you. Depending
on how many effects that are contained in the script, this edit can be easy or
it could be time consuming. As you scroll through the document, you will be
able to see all of the effects listed out in order of operations. What you are
going to look to change is the ExecutionMode part of each effect listing. A
freshly created script may have them listed as either Interactive or Default.
You want to change all of these to Silent, that way when you run the finalized
script, it won’t have fifty-billion pop-ups for every single effect for every
single name on every single tag that you make. It will run them silently, with
the settings that were already in place at the time of recording. An example of
how it should look can be found below:
Once
you are done setting all of the effects to Silent, you can save the text
document and close it. Congratulations, you’re almost done with your first
scripted tag! By this point you should have your file structure set up, your list
of names ready, your blank tag created, your text script and your effects
script written. The only thing left to do now is to write the main script file.
Open
the TJP-MakeTags file that you downloaded earlier. Inside of it you will find
the main script writings. The first thing that you are going to want to do is
change the ‘Host Version’ option at the very top of your document. By default
it is set to run with PSP 8, so you need to change it to reflect your current
version of PSP. So if you use PSP X4, then you will change the setting to
14.00.
Next
you will scroll through the document until you find the Set Global Variables
section of the script. This is the portion of the script that you will always
focus on when it comes to writing the main script for each of your tags. Each
main file will be different depending on the tag you are working with. So,
using the PUTTAG1 example again, let’s set up the final script!
The
first thing that you are going to want to change under the Global Variables is
the strListofNamesFile setting. At the start it is listed as strListofNamesFile
= r''. You are going to modify this string with the address of your names text
document which should be saved in your Scripts-Trusted folder. So, open up
Windows Explorer once again, and travel through the tree to get the exact
address of your file. It would look something similar to this:
C:\Users\YourName\Documents\Corel
PaintShop Pro\17.0\Scripts-Trusted\nameslist.txt
So,
this is what the string would look like when you have located your text
document and input the address:
strListofNamesFile
= r'C:\Users\YourName\Documents\Corel PaintShop Pro\17.0\Scripts-Trusted\nameslist.txt'
The
next string that you are going to edit is right beneath that, known as the
TagTemplate string. This will be the address of the blank that you made
earlier, found in your Scripts-Trusted/Tags folder. Once you have the exact
address of your blank, input it into the string so that when you have finished
it looks similar to this:
strTemplateFileName
= r'C:\Users\YourName\Documents\CorelPaintShopPro\17.0\Scripts-Trusted\Tags\PUTTAG1.pspimage'
The
next step is completely optional, but I find that it helps a lot when making
multiple tags. You can set the File Prefix string to add wording to the
beginning of your saved file. So, for example, if you wanted to you could fill
in that string with ‘PUTTAG1’ and it will then force the script to name the
final tags PUTTAG1Amber or whatever the names on your list are. This will make
sure that every time you run a main tag script, it doesn’t try to say that the
tags are already made. They’ll have individual names based on the name of
whatever tag you are making. Nifty, right? Right!
The
next string that you have to modify is the strTagScriptFile1 file extension.
What you will edit this string to include is the text script that you created
earlier. For this example, it would look something similar to this:
strTagScriptFile1
= 'puttag1text'
Similarly,
the next string that you will edit is the strTagScriptFile2 file extension.
What you will edit this string to include is the effect script that you created
earlier. For this example, it would look something similar to this:
strTagScriptFile2
= 'puttag1effs'
Next,
you will set the file format that your tag is going to be saved in. 1 for .JPG
files or 4 for .PNG files are the most commonly used formats. In the animated
tag tutorial we will work with the 3 for PSP 7 option, but for now ignore 2 and
3. Once you have set your file format, then you can move on. File compression
depends on your own personal style, and the case font option depends on your
name list. I make separate lists with mixed case, lower case and upper case names
so I don’t have to mess with that option.
The
very last thing that you need to edit in this file is the path directory to
where the tags will be saved into. This would be the final folder that you
created in your folder structure set up. So, for example, if you placed the
folder on your desktop it would look something like this:
strSaveDir
= r'C:\Users\YourName\Desktop\Saved Tags’
Once you
have all of your strings completed, save this file into your
Scripts-Trusted/Scripts folder. The name that you save it as will depend on the
blank you are working on, so for this example, the final script would most
likely be saved as PUT Tag1 Script, or something similar.
If you
have followed everything up to this point, it is time to see your script in
action! Back in PSP, choose the script you just created from the drop down menu
in the Script palette. Once you have it selected in the menu, then choose the
Run Selected Script button. If everything is set up correctly, then it will pop
open a menu with the name of your blank already filled in. Click okay. It will
ask you if you want to run the script with the settings chosen, click okay.
Again, if everything is set up correctly, then the script will begin to run
through the list of names that you created earlier. Once it is finished, it
will pop up that it’s finished, and then you can go to the location where you
chose to have the tags saved to check them out!!
If your
script did not run correctly, or it threw up an error of some sorts, go back to
double check that there were no typos in your editing, and that everything is
labeled as it should be. Feel free to e-mail me at anoblivioncreation@gmail.com or ping me on Facebook if you have
any questions!




Thank you for this tut. I maybe able to tackle scripting for good!!!!!
ReplyDelete