The script failed – What is that error?

If you are a PaintShop Pro user, you might have found and used some scripts. They are a series of automated commands to accomplish various tasks for you, faster or more accurately. However, running a script will occasionally lead to an error (and an annoying sound). Most failures will show an error message that will be meaningful to the user, or the one coding the script.

Where can I see the error?

Typically, it is a good idea to open the Script Output Palette when you run a script. This will allow you to see occasional commands, or instructions. That is also where you will see the error appear, in red. If the Script Output Palette (SOP) is not open when you run the script, it will open by itself to show the error message.

The error message is typically longer than the width of the SOP so you will need to scroll to the right to read it all.

 

Parts of the error message

The complete error message is very meaningful to the coder, but only as long as all those parts are available. This means that if you need to contact the designer, don't take a simple screenshot of the SOP because the error will be quite incomplete and often unusable to find the actual error to fix. So an image like this does not give much details (this is from an old PaintShop Pro version 9).

Luckily, newer versions of PaintShop Pro will not extend the message too wide. They will give the line number in an easier location!

The important parts of an error message are these:

  1. What command  is causing issue and cannot be executed? This can immediately give a clue to the user or the designer. As you can see, the 10 or 20 previous commands have no meaningful information on the particular error.
  2. What line number is that command in the script? Since a specific command can appear in multiple locations in a script, it helps pinpoint where the problem is
  3. What is the problem? this part will often give a clear message as to what is the problem. It could be a syntax error, missing supplies or other.

The script has attempted an operation that is not permitted in a restricted script

This is a common error that a user will encounter. It is simply a matter of putting the script in the correct folder. There are two folders where you could save scripts: the Scripts Restricted and the Scripts Trusted. Some scripts will execute some specific commands like closing an image, saving a file, etc. Those commands require you to save the script in the Trusted folder. If you put it in the Restricted scripts folder, you will get that error message. The solution is simply to move it to the correct folder.

One thing to remember is that PaintShop Pro will try to run the script from the Scripts Restricted folder first. If there is a copy of this script in the Restricted folder, it will not check the Trusted folder. Make sure you don't have a duplicate of that script in both folders. If you are sure that you have only one copy and it is in the correct folder, yet you are still getting that error, check the File location preference. If you have accidentally pointed the program to use, for Trusted scripts, the folder that has Restricted scripts or vice versa, you would encounter such issue.

If you have tried that, and still get the error message, simply edit the name of the script that is in the correct Trusted scripts folder. You can add a -x at the end, and then, run that one. At least, since you edited a single file, you are sure there won't be any duplicate anywhere!

The file name specified is invalid

Some scripts will need to be edited by the user to identify a specific path where supplies can be retrieved or where files should be saved. By default, it will include something very generic like 'C:\\Templates' but it is unlikely that you will have the same files and folders on your computer. If you fail to edit that line, as instructed in the README file, you will get that error. The same thing will happen if you mistype the correct path. Then, the script won't find its way to that path you typed since it does not exist!

Arrange command invalid in the current state

As this says it, the command that the script is trying to execute is to rearrange layers. Maybe it wants to move the layer above another one, or below. Typically, that is an easy command to execute except if you try to move a layer below a background layer. You cannot put anything below the background layer so you would get this error.

If you see this, check the Layers palette and see if you have a Background layer. If so, convert it to a raster. It might be just enough to fix the script running for you.

Internal program state invalid

This error message is a bit scarier as it does not seem obvious. However, like the previous error, the script is attempting to execute a command that is not possible in its current state.

For example, the script might try to move a single layer in the Layers palette. It is impossible to arrange anything, and even if you change the layer from a Background to a Raster, it won't do anything because... you cannot reorder one layer only! The solution to this is to check the command it tries to execute and look at the image or the layers to see if that command can even be executed with what is available.

The clipboard does not contain any visible data

As the script tries to copy and paste some layers or other selections, it might happen that the copied part was empty. Maybe it was an empty layer or there was a tiny selection somewhere that the program copied instead of a whole layer for example.

If you see this error, check the source of the copied selection and see if you have the correct layer active. You can also Deselect (Ctrl-D) to make sure that a larger area would be copied.

There is also a possibility that a selection was supposed to be made but expected to be on a larger image, so the selection ends up being outside of the image if you are currently working on a smaller one. If that is the case, you would either need to use a larger image or readjust the script (which means editing it).

These are some common script errors that a user might encounter as long as the script is not faulty (which can also happen). These are typical errors that the user can figure out a simple solution for. Of course, as a user, if you cannot find the solution or if you encounter a different error message, you can definitely contact the designer. As mentioned above, make sure you send the whole error message, but you don't have to copy everything in the Script Output palette as the dozens of commands executed before that point are usually meaningless for this particular error.

What other error have you encountered? Send me other screenshots of your error and I can update this post or write another one.

If you have other issues in running scripts, check out this Troubleshooting guide too.

If you want to add scripts to your toolbox, there are a variety of them in the store.

For Photos That Matter

1 thought on “The script failed – What is that error?”

  1. I want so badly to run a script that will do sigs/tags with 75-100 names, one script to run the script for the sig/tag and do the names individually, of course, so I won’t have to do them individually myself…..and this was a good article…I make and use and correct my own scripts all the time….

Leave a Comment

Enjoy our Christmas Countdown, from Dec 1 to 24.