The Importance of Scripting
The root of all of this has Photoshop scripting a series of steps for it to follow for itself. When you are recording an action, droplet, or batch, you are invariably creating a programming script that Photoshop is following. You’re just not programming it on your own. There could be times, however, where you will need to work on a much more complex automation projectbeyond what Actions can do for you.
Adobe allows you to create customized scripts that Photoshop can follow using AppleScript, VBScript, or JavaScript. To increase the likelihood of cross-platform performance, JavaScript is usually the tool of choice here. If you are versed in either of these languages, you can go to the Adobe Photoshop Scripting page and download the scripting guides. These guides give you the background information into scripting for your specific language to make your own customized set of steps for Photoshop to follow.
Does this mean that individuals who are not familiar with scripting are left out in the cold? Absolutely not! In fact, Adobe took great steps to ensure that both developers and non-developers alike would get a good jump on creating these scripts by creating the Script Listener plugin.
On your machine, navigate to the Photoshop CS5 folder. You’ll note that there are a series of subfolders present in there, once of which is called Scripting (see Figure 6). In that folder, you’ll find the guides for scripting as well as the Scripting Listener plugin (under Utilities). Copy that plugin into your Plugins/Automate folder and restart Photoshop.
The moment that you start your first command in Photoshop, you will notice that a file is created on your desktop called ScriptingListenerJS.log (see Figure 7). Opening that file in your text editor of choice (for Mac, I use TextWrangler; PC users can use Notepad), you will notice that the JavaScript equivalent of the step that you performed in Photoshop is saved in the file (see Figure 8). As you perform other steps in Photoshop, the steps are separated by a series of commented lines, making it easier to read. By performing basic steps in Photoshop and coming back to check the script log, you can get an idea of what the JavaScript pieces look like for what you are trying to do, and work on creating a script that you can execute later.
I recommend a few things when you are doing this, however:
- When you start working on a script, go into the SciptingListenerJS.log file and delete any of the entries that are already there. Save the file and close it once that is done. Keep in mind that Photoshop is recording everything into this log file, so it can get very hard to read very quickly.
- Break down any action that you are trying to work on into a series of dedicated steps. If you are trying to duplicate a layer and center it, treat this as two separate steps. Record the duplicating of the layer and copy that out to a separate file. From there, center the layer, and copy that step as a separate text. This will ease any confusion that you may have on what step performs what.
- Try not to include any steps that have you writing or doing things that are valid to just one file. If you create a text layer and write the words “To Remove”, understand that this will be repeated on every image you run the action against. If whatever step you are trying to work on is something that only a few images need, consider doing this step after your batch processes.
- Once you are done with using the Scripting Listener, quit Photoshop and delete the file from the Plugins/Automate folder. This is why you copied the folder instead of moved it. If you leave this plugin running and recording all of your steps, the log file will continue to grow and grow, making the size bigger and bigger. Bad things can happen. By getting used to copying it over and deleting it when you are done, you mitigate this.
Once you have assembled the pieces that you need for your Photoshop project, save the file as a text file with an extension of JSX (see Figure 9). This will let you find and execute the file from Photoshop.
Start Photoshop and go to the File > Scripts > Browse directory. From here you can specify which script file you want to run and you are done!
The great part about working with scripts in this fashion is that you can create actions and droplets that create these steps as well! Simply go to the Actions palette and start recording an action as you normally would. Click on File > Scripts > Browse and run the script that you created. You will notice that inside of the Action, it points specifically to where the script is locatedrunning your script for you. The only thing that you need to keep in mind here is that you should house all of these scripts in a specific location on your computer.
If you transfer the scripts, batches, or actions to other users, they will need to have those specific folders on their computer or will need to re-record the scripts with the locations to the files once again (see Figure 10). Taking a couple of steps of precaution in the beginning and building slowly can turn your Photoshop into an efficiency machine!