PhotoshopNews.com
Apr 20, 2005

What’s new in Photoshop CS2 Scripting

In addition to the other exciting new features of Photoshop CS2, the scripting engine has received some substantial enhancements. Here’s a look at what’s new to the JavaScript engine in Photoshop CS2.

ScriptUI
For creating user interfaces within your scripts, Photoshop CS2 will provide some new control objects. Specifically, IconButton, Image, Progressbar, ListBox, and DropDownList (a.k.a. popup menus) are new. There are also Panel and Group objects for better organizing controls within a dialog window, and a new AutoLayoutManager so you no longer have to specify exact coordinates for placing controls.

New Classes
Experienced scripters are well-aware that not all of Photoshop CS’s functionality was exposed in the JavaScript Library. The work-around has always been to use the Script Listener plug-in and Action Manager in order to get the job done. These tools are still available in CS2 and the Action Manager code from CS that I’ve tested in CS2 still appears to work fine. In addition to this, some of the missing functionality has been exposed in the JavaScript Library in CS2:

Events
Scripts and actions will now be able to run in response to events happening within Photoshop CS2. For example, you’ll be able to automatically trigger a script whenever a new document is created, or when Photoshop CS2 closes, or when a document is flattened, plus many more. To simplify the creation of these “event handlers” Photoshop CS2 will include the Script Events Manager. For a sneak peek, take a look at this article [http://photoshopnews.com/?p=230]. In addition to allowing the user to attach scripts or actions to specific events, the Script Event Manager is written in Javascript itself and serves as an example of how to create and manage handlers.

Interapplication Communication
In Photoshop CS2, it will also be possible to communicate with other Creative Suite 2 applications through scripting. In fact, you’ll be able to send them entire scripts to run and return their results. So, for example, you might configure a script in Photoshop CS to run whenever a file is saved. This script could ask Bridge to re-build its image thumbnail for that file so when you switch to Bridge, it’s already updated. Or it could tell Bridge to apply a particular label to a file that’s been sharpened and saved. There are lots of possibilities here and you’re not just limited to talking with Bridge.

ExtendScript Toolkit
The Debugger window has been replaced with the ExtendScript Toolkit window. (ExtendScript is Adobe’s name for their JavaScript implementation). With the ExtendScript Toolkit window you can now edit, as well as debug, your scripts with color syntax-highlighting and track live data or the call stack while a script is being debugged.


Click on the image to see the full dialog in a new window.

Improved Documentation
Finally, Adobe has done a very nice job of expanding and improving the documentation as well. You’ll find the Photoshop Scripting Guide and reference guides for JavaScript, AppleScript, and VBScript in the Adobe Photoshop CS2/Scripting Guide folder. There are also a number of example scripts to be found there.

Thomas Fors is an Engineer at Argonne National Laboratory near Chicago by day and a photography student by night. His interest in photography began in 2000 when he enrolled in a class at the local community college to learn how to use his camera. From the moment he watched his first print develop before his eyes, he knew he was hooked on an expensive new hobby. Thomas is also author of the ACR-Calibrator script which helps automate the calibration procedure developed by Bruce Fraser in his book Real World Camera Raw with Adobe Photoshop.

Editor’s note: Thomas was also on Photoshop CS2 beta this time around and contributed greatly in testing out the new scripting additions to Photoshop CS2 and Bridge.

Comments are closed.