Wednesday, 26 October 2016

Scripting Tags Tutorial ♥

How to Script Your Tags

Hi everyone!

I wanted to get a tutorial posted for you all to learn how to script your tags.
So much easier than tagging them all individually!
Your first few go arounds with scripting may feel time consuming,
but once you get the swing of it, you'll be tagging your tags in record times!

A  huge thank you to Sandra from Sandra's Slamming Tutorials for the supplies and teaching me.
Because of her I am able to write this tutorial for you all ..

Okay, let's get started!
It is a long tutorial, BUT that is because I have tried my hardest to explain everything.
I don't want it to be confusing, if possible.
So just do it a bit at a time, and if you question anything at all, I'm around.


Download:
MY SUPPLIES HERE

First, a bit of information about scripting tags.
I am a dinosaur, using PSP 9, but this should work on any version of PSP.
I, personally, create a folder on my C drive and name it 'scripting'.
That way, all of my supplies and folders when scripting happen in the same place.
I will write this tutorial under the assumption you will be doing the same.
You are free to name your folders anything you like.
Just remember that whatever you name them, is how you have to name them when editing.
I will touch all of this again in the tutorial!
--------

Let's begin by creating the folder on your 'C drive', name it 'Scripting'.
Inside of this folder, create 3 more folders.
I've named mine 'Finished', 'Scripts' and 'Tags'.
Finished - the folder that your finished tags will save in.
Scripts - the folder that you will save your scripts in.
Tags - the folder you will save your tag template in.

Now, inside of the zip you downloaded up above, you should have three items.
Take all 3 of the items and paste them into the folder that we just created.
So you should now have a folder that looks like this:


First, let's deal with the '~TJP-MakeTags' file, which is a script.
This file needs to go in the 'Scripts-Trusted' folder of where your PSP program is.
So for me, I have Windows 10.
On my C drive, I have a Program Files (x86) and my Jasc - PSP folder is in there with all other programs.
So, when you find your PSP program, you should see a 'Scripts-Trusted' folder.
Paste the '~TJP-MakeTags' file in there.
Okay, now let's go back to the folder we created a few minutes ago.

The next file 'TJP-MakeTagsTextForScript1' we leave it as is.
It stays right where it is.  Click on it, and you will see some code on it.
When we are recording the script, we will be using that code, so it's best to stay right where it is.
We will come back to it.

The last file is 'extranames-example'.
This will be where you add your names that you want the script to record on your tags.
So if you have an Always List, you add the names on this file.
I have renamed mine 'extranames' - so please do that. (no spaces)
You can name it something else if you like, but remember it will be the name you need to add to your script when I am adding 'extra names'
Added Tidbit:
 You can make various name lists in your folder, if you have an Always List for ex.
Then, I always copy and paste a list I need onto the 'extra names' folder.
It will make your life easier, however, for today just the 'extranames' folder please.
You can change the names on the list to names you want on your tag.
Make sure it is one after the other.

- The script will add names just as you type them on the list.
-  Exception: If the font you are using has no capitals, the script will not use capitals.


Now that we have moved things where they need to be, & understand what everything is, 
it is now time to record a script.

In PSP, open up the tag that you are wanting to script names onto.
First things first, it does not recognize .psd files, so your tag template needs to be .pspimage extension.
Please, save your tag as .pspimage into the 'Tags' folder which you created earlier.
Remember: All .pspimages need to go in this folder when you want to script them.
So this folder is where all of your blank tag templates will go.

So we are staring at our blank tag in PSP now.
In the top right corner, you should see your script buttons.
They look like this:


Now before we start recording the script, I always make sure I have set my things up.
So, if you are using a plugin, a PSP effect or drop shadow, run through them.
That way when you are recording, it goes quicker. (just my preference)..
Remember: 
You should not move the text once typed onto the tag.
Try to find the place exactly where you want it to land first shot.
Sometimes when recording the script, it will move the tag, but some names it won't.
You will find yourself going back through tags to see which worked and which didn't.
(just my own experience)

Now, hit the 'start script recording' button and using your own name, add the name and go through the motions.
Once you have the name where you want it, hit the 'save script recording' button.
Your script file must be identical name as your .pspimage file, except it will have .pspscript extension.
Save it into your folder you created called 'Scripts'.


Also:
If you are recording your script and you make a mistake or want to start over,
there is also a cancel button.  (the 'x' button)
So once you hit the red 'x', you are able to hit record and start over again.

So, we have now recorded our script, and now all we have to do is set the scripts up so it knows what to do.  

See the dropdown list just before the script buttons, that is where you will find your saved script and the original one we added to our Trusted Scripts folder.
Look through the list and find the one you just recorded (the tag name)
When you find it click on it so it shows.

For instance, the tag I am scripting has the filename 'LoveYouKajasylviescandal.pspimage'
The script I just recorded and put in Scripts folder is 'LoveYouKajasylviescandal.pspscript'
So, in the dropdown, I am looking for 'LoveYouKajasylviescandal'.

Once it is selected, you now want to click on the 'Edit Selected Script' button.


You should get a popup, and at the bottom right corner there is a button 'Text Editor'



Click it and it should open up a notepad with some code.
Do not panic!
We only have to make two amendments to this code.

Go  to the folder we created earlier and open up the file 'TJP-MakeTagsTextForScript1'
We need to add this code to the notepad of code we just opened up.
Highlight the code from 'TJP-MakeTagsTextForScript1' so even the spaces at the beginning are highlighted also.
Now right click and copy that highlighted text.

(You will be adding this code to every tag template you want to script)
That is why we keep it handy in that scripting folder.

Now, go back to the code that we opened when we hit 'Text Editor' from our tag script.
In the second paragraph of code, it says 'def Do(Environment):'
Put your cursor right after that and hit enter once so it brings you down to the next line.
It is important you are adding no extra spaces or letters.
Now paste the code right there.
Here are 3 images for you to see what I have done.
(don't save the file yet, we have one more thing to do)





Now once you have that code pasted in, scroll down until you see 'characters: u: 'your name here'
Yes, you will see your name, or whatever name you typed on the tag when recording the script.
So this is how mine looks.


You need to change it so that it says TagName like shown in the image below.


Now you can save the file.
File - Save As.
(keep the filename the same as it was)

Now, here is the last step.
I know this all seems very confusing, but I promise it will all come together in the end for you.
Especially once you do this a few times.
In that script drop down (just before the script buttons) where your tag script name shows,
scroll down and find the one we added in the Trusted Scripts folder earlier.
'~TJP-MakeTags'
Select it in the dropdown, and hit the 'Edit Selected Script' button like we did with the earlier script.
You should now see a bunch of stuff, we are going to scroll passed it.
Look for this:

##################################################################################
#   Set global variables.
##################################################################################

Once you see that, we are editing what is below it.
Now, this is where we point to everything  that PSP needs to find.
Each 'area' has a space between it, like paragraphs.
So when i say part 1, it's the first 3 lines before the space.
We deal with a part at a time. Images are provided below too, to help.


The first part is asking for where the list of names is.

# The name of the file with the list of names. Full path should be included.
# Put the file name inside the quotes. Leave the r there. E.G. r'E:\Names.txt'

That was our notepad file in the folder we made with a list of names you want on the tag titled 'extranames'.
So it is asking us to point out where our names list is it can grab names from.
Go to the folder where that names list is, and then grab the path (URL) up  top.
So, if it is in the C drive and your folder is named Scripting it will start like this:
C:\Scripting



And then you have the notepad file called 'extranames' in that folder, and it is a 'txt' file.
So the full path (URL) to put between the quotes is C:\Scripting\extranames.txt
Since 'txt' is the extension of a notepad file.
(Now remember, if you placed your folder elsewhere, your 'URL' will be different.)
So this is what you should see in your script editing.


Now scroll down to the second part.
It starts with:

# The name of the file which the tag is based on. Full path should be included.
It is asking is to show where the tag template can be found of the tag we just recorded a script on.
Remember, we added the .pspimage into the 'Tags' folder of that folder we made on the C drive.
So, the path (URL) we add would again be C:\Scripting\ and then the .pspimage file name.
So mine would be 'C:\Scripting\LoveYouKajasylviescandal.pspimage'



Now, the next 2 parts are optional, they're one line each and I skip them.

So, go to the next part which starts with:

# The name of the script which is used to write the text on your tags. Should not include a path or
# the .PspScript file extension.
It wants to know what the name of your script is exactly.
Remember we named it to match the .pspimage file as we were recording it.
That is in the 'Scripts' folder, of the folder we created on the C drive.
It does not want the path or the extension though, just the name.
So, i would type in LoveYouKajasylviescandal.


Here is an image to show what we have so far:


We are almost finished!!
Next part is:

# The name of the script which is used to format the text on your tags. Should not include a path or
# the .PspScript file extension. Optional.
I skip it, put nothing there.

Next is it wanting to know if you want to save your files in jpeg, .png etc.
I like saving my tags in .png, so it has no white background, therefore I choose '4' for .png.

# The file format: 1 for JPG, 2 for PSP 8, 3 for PSP 7 (Animation Shop) and 4 for png
intFileSaveType = 4

Now scroll down to the part that says:

# The full path to the directory that the tags will be saved in without the final back slash
# Put the directory name inside the quotes. Leave the r there. E.G. r'e:\tags'

It is asking us where we want the finished tags to save.
So, once again we go into our folder that we created on the C drive.
Then, go into the folder that we named 'Finished'.
Grab the path (URL) at the top.
Mine is 'C:\Scripting\Finished'

Here is an image showing it, as well as the parts in between in case you need to compare.
We didn't touch them, however, if something needs to be changed on your end, you can see what I have.


Now, save that file (keep the filename the same).
Go back to PSP, and shut down the blank tag.
(It will pull it back up for you when you run the script).

Ready?
Let's double check everything.
We added our .pspimage into tags folder. - CHECK
We recorded and saved our script into scripts folder - CHECK
We edited our tag script - CHECK
We edited our trusted script - CHECK
Now it's ready to rock n' roll!

In your scripting buttons in PSP, there is one called 'Run Script'.
It is telling PSP to grab everything we set up for it, run the script and make the tags.
Press it and see what happens.
It should start tagging the tag for you!
Wooohoooo we are FINISHED!

IF IT ISN'T WORKING

Double check that all of the file names are named exact as they should be.
Remember, they have to be exact like one another too.
Check your .pspimage, then your .pspscript.
Also the paths that we pointed it to in the '~TJP-MakeTags' script.
If they aren't named identical the script won't know what to do.
They all need to reflect an identical name.

Sometimes you have to hit 'Ok' for it to go on to the next tag.
It happens to me sometimes, just hit 'Ok' and it will move on to the next one.
It does this when using plugins or effects sometimes.
A popup will appear saying Finished when it's finished.
Go check your 'Finished' folder and see if all of your tags are there.

If your blank pulls up with a name on it, and the script is putting a name over a name.
Shut down the scripting, and resave your .pspimage as a blank into your 'Tags' folder.
Then start over.

When you have to shut down your script mid-scripting:
You must go into your finished tags folder and delete the tags it made.
If there are already tags in there, your PSP will start at the last name it hasn't already tagged.
So that folder must be empty again.
Once it is empty, it will start again from the very first name and redo the tags after you have made a correction to your blank tag.

ONE LAST THING
You have already set a lot of it up, and only need to amend certain things each time you script now.
So next time you are scripting a tag, here are the steps.


1/Save your blank tag in the 'Tags' folder.
2/ Record your script and save into the 'Scripts' folder.
3/ Edit the tag script to add the code and change your name to 'TagName'.
4/ Edit the '~TJP-MakeTags' script and change the file name for your .pspimage & script.
5/ Ensure your 'Finished' folder is now empty.
6/ Add the names you want on your tag to your 'extranames' txt file.

That is it, it will become a routine.
Taking the time to add names to every tag is so time consuming.
So, hope that this tutorial has helped you to make some sense of how to script tags.

Thank you so much for trying it.
If you have any questions at all, don't hesitate to ask!
I'm always around in forums, on Facebook, by email and here by comment on the blog.



Tutorial  © sylvie's tutorials.
Thank you so much for trying my tutorial.
Posted October 26, 2016.


2 comments:

  1. Thanks so much for this tutorial!

    ReplyDelete
  2. So very welcome Marlene, thanks for stopping by!

    ReplyDelete