How do you create custom scripts for automation in Photoshop?
I have been recording custom actions to perform various automations, though I am starting to require greater control which would be better implemented using some form of scripting (if this can indeed be done). I have seen "ExtendScript" has been mentioned in several places, though I cannot find that option in Photoshop.
It is important that I can easily share such scripts with other Photoshop users so that they can also benefit from them. For example, I would like to allow people to download the action scripts from my blog with relative ease.
I am creating my actions using Photoshop CS4 which allows users with newer versions to utilise them. The same would need to be so for my custom scripts.
Adobe provides a program to make scripts called ExtendScript Toolkit, which was most likely bundled with your install of Photoshop. On my computer it's in
C:\Program Files\Adobe\Adobe Utilities - CS5\ExtendScript Toolkit CS5. You can use that or a program as basic as Notepad to create scripts (I use Notepad++), which you then save into
C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts or the equivalent
Presets\Scripts folder on the Mac. In Photoshop, go to
Scripts to find your script and run it.
Adobe's documentation is a good place to start. They have basic guides to get you started, from "Hello World" on up, and then they have more in-depth tutorial PDFs by language and version.
Sometimes, it's nice to interact with ExtendScript Toolkit's Object Model Viewer (Click
Help up top, then
Object Model Viewer to access it). You'll also find a link to the
Help menu...that gets you some more help with JS functions like the XML Object that are common to all CS products.
If you're looking for help online, the Adobe forums are the most populated. You can also try over on Stack Overflow, but the ExtendScript help tends to be spotty.
If you want help working with ScriptUI, Peter Kahrel's publication on it is really informative and helpful, more so than Adobe's documentation on the subject in my opinion.