//, Photoshop/Understanding Scripting in Photoshop

Understanding Scripting in Photoshop

Whether you want to automate tedious tasks, customize commands, or add new features, scripting takes the world of Photoshop to another level. In this tutorial I’ll make you aware of what scripts are capable, where to find them, how to edit them and how to use them. Eventually I’ll follow up with how to make your own scripts but for now that’s a topic for another day.

If you use Photoshop on a daily basis you’ve probably found yourself doing the same tasks over and over again and it would be nice to have the ability to automate those things to save yourself some time, right? Well scripts make that just a tad bit easier.

First things first, to speed up your understanding of scripting, you should probably download some existing scripts from the various repositories and websites that offer them. Here’s a list of places that offer free Adobe scripts for Photoshop and other Adobe products.

Adobe Exchange Repository

Ps-Scripts

Graphicsoft

You may have noticed that some of these sites offer ‘Actions’ as well and you might be asking yourself, how does an ‘action’ differ from a ‘script’? Actions (in Photoshop) are a means to record all commands used to generate an effect in Photoshop for the purpose of re-application later. Many people say that scripts are similar to actions because they can both be used to automate tasks, but scripts can do so much more then what was possible with actions. For starters scripts have conditional logic which makes it possible to automate different outcomes based on various inputs. Essentially scripting Photoshop is programming and thus it uses various programming languages for results.

So what can you do with scripts? A few examples are using Photoshop to snatch frame grabs from a video source, turning a photo into a rainy day or to turn RGB values in an image into swatches automatically.

For the purposes of this tutorial I’ll only deal with JavaScript since it is platform independent (Mac and Windows). Also available are Visual Basic (Windows) and AppleScript (Mac) commands.

Adding and Using Scripts

  • After downloading scripts you’ll need to install by navigating to Applications >> Adobe Photoshop CS2 >> Presets >> Scripts.
  • Drop your file into the ‘Scripts’ folder and launch (or relaunch) Photoshop.
  • Open your image in Photoshop.
  • Select File > Scripts and select the script you wish to use.
  • A dialog window may pop open asking if you want to apply the script. Click ‘yes’.

Bam you’re done. Scripting is really that easy. Now for the harder part.

Writing or Editing Scripts

Regardless of whether you install a single CS3 application or the entire Creative Suite, two other applications are installed by default: Adobe Bridge and the ExtendScript Toolkit. The ExtendScript Toolkit is a coding environment that aims to allow you to add new features to Adobe products through scripting.

  • Find the ExtendScript Toolkit. Go to Applications >> Utilities >> Adobe Utilities >> ExtendScript Toolkit2. In some rare cases this may not have been installed or deleted. No worries, the toolkit can be downloaded for Macs here and PCs here.
  • You’ll see a window with Photoshop-like palettes on the left and a text editor on the right.
  • Choose File > New JavaScript. This will create a blank file with an area on the right ready for you to type. If you’re editing a script, instead of creating a new file you would simply open that script instead.
  • Understanding the window in front of you is critical. First, the ‘Select Target Application’ option tells ExtendScript which application you are writing the script for. In the top left dropdown menu select Adobe Photoshop CS2 or 3 (depending on your version). When asked if you want to start the application, choose ‘yes’.
  • If you aren’t familiar with scripting or you’d like a reference guide, download the Photoshop JavaScript Reference Guide.

This concludes our tutorial. Stay tuned to this column because in a future lesson I’ll help you go beyond these steps to actually writing and creating your own scripts from scratch.

2010-05-19T22:54:37+00:00 April 24th, 2008|JavaScript, Photoshop|0 Comments

About the Author:

Leave A Comment