Skip to content

Photoshop Scripting Beginners Guide

January 11, 2013

Lately I’ve been spending a lot of time creating importers and exporters in Photoshop for various tasks such as importing 3DS Max Render passes and applying layer styles automatically.  Figuring out how to script in Photoshop was difficult to discover, but it’s actually pretty easy to do.

First off, there is a programming IDE already installed.  It’s called ExtendScript.  In CS5 it’s located in the following folder, but it’s in a similar folder in newer versions of Photoshop as well:  C:\Program Files (x86)\Adobe\Adobe Utilities – CS5\ExtendScript Toolkit CS5

To script you can use VBScript, Apple Script, or JavaScript.  Personally coming from a non-intranet web development background I chose to work in JavaScript.  For that you will need the help files.  They’re tucked away in two separate folders because that’s how Adobe rolls.

  • C:\Program Files (x86)\Adobe\Adobe Utilities – CS5\ExtendScript Toolkit CS5\SDK\JavaScript Tools Guide CS5.pdf
  • C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Scripting\Documents\Photoshop CS5 JavaScript Ref.pdf

The first PDF is useful when you want to figure out how to work with files and folders in the file system.  The second PDF is useful for everything else.

After working with the language for a while, you’ll eventually find that some commands just plain don’t exist.  Photoshop has one more language up its sleeve.  It’s the one they use internally to create the undo stack.  Fortunately they have a plugin to make figuring it out easier.  If you copy the plugin out of the folder it’s in and into the Photoshop plugins folder, Photoshop will write two different text files to your desktop.  With every action you perform, the text files get updated with JavaScript or VBScript for that particular action.

  • C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Scripting\Utilities\ScriptListener.8li
  • C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Plug-ins

Just copy and paste the actions from the desktop text file, modify them to your hearts content, and almost anything that Photoshop does in its user interface can be done pragmatically.

One last note is I’ve found the site is very useful.  And I use this helpful search on google to find things in its forums.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: