Targeting Photoshop with a Script
With Photoshop CS2, Adobe added a new file type: .jsx
Using this new .jsx extension, you can target a specific Creative Suite application (Photoshop, Illustrator, InDesign, GoLive) to run a script. Let's specifically call Photoshop by adding the following code to the top of your script:
// enable double clicking from the Macintosh Finder // or the Windows Explorer #target photoshop
Now, when you double-click your script, it will automatically run in Photoshop. It will even launch Photoshop if it isn't already running.
Doing this allows me to add scripts to my OS X dock so I can single click them without going back to the OS finder to launch them.
If I want the script to be accessible via a keyboard shortcut, I can always add an action to trigger the script via a keyboard shortcut.
If you don't target a Creative Suite app, the .jsx files will open with Adobe's ExtendScript Toolkit.
Learn more about Adobe's ExtendScript Toolkit.