Scripting in Photoshop CS3 – Part 1

Scripting in Photoshop CS3 – Part 1

I have been working with the scripting in Photoshop CS3 a little more and quickly found some very useful resources and tools.

First in the list of useful resources is the scripting listener which can be found in “Scripting Guide/Utilities/”. In order to make this work you drag the “ScriptingListener.plugin” into the “Plug-Ins” directory and restart Photoshop. Once the listener is installed and restarted you are ready to start script watching.

Photoshop will spit out a log file (named “ScriptingListenerJS.log” on the Mac) to your desktop. Here is a sampling of what that listener returns

var id1 = charIDToTypeID( "Opn " );
var desc1 = new ActionDescriptor();
var id2 = charIDToTypeID( "null" );
desc1.putPath( id2, new File( "/Users/mkeefe/Desktop/Picture 4.png" ) );
executeAction( id1, desc1, DialogModes.NO )

Basically what that does is opens an image “Picture 4.png”on my Desktop. Of course at first glance you are probably scratching your head, but don’t be alarmed it is fairly simple to understand.

Lets go through it line by line.
Line 1: setup character id of “Opn ” which is “Open”
Line 2: set an action for photoshop to reference
Line 3: make a path reference for the file we want to open
Line 4: Last but not least, we actually call the desired action passing in the variables we set in the last few lines.

I will be writing up some more in depth articles on scriptplayground.com once I get some more free time.

Thanks to Jeff Tranberry and Thomas Ruark for answering my list of questions at PhotoshopWorld. In fact Jeff is hte one that alerted me to this scripting listener at his “Photoshop for Geeks” session at PhotoshopWorld Boston.

In the next part I will explain the “Object Library” browser.

No Comments

Post a Comment