Actions, in contrast to scripts, are a series of recorded steps within the program. They cannot talk to other programs. Logic can be built into actions using Conditional Mode Change. Conditional Mode Change is a Photoshop automation function that applies rules to change the image color mode based on certain conditions. For example, part of an action may require the image to be in CMYK mode and another part of an action may require RGB mode. Here, Conditional Mode Change is helpful. Refer to the Adobe Help Center for information on Condition Mode Change.
Scripting and the Adobe Creative Suite
Think of scripting as that studio assistant you can't afford to hirethe one who does all the little tasks, freeing you to be creative and dynamic. No, scripting won't make coffee (yet), but it will handle many of the small-but-important tasks that seem to eat up the workday.
Scripting can also be used for those jobs not within the scope of actions. Have you ever wanted to add the name of a file in, say, the lower-left corner of the image, along with your copyright information? And you wanted to do this to an entire folder of imageswithout losing a night's sleep? What if the images are not the same size or orientation? An action in Photoshop or Illustrator isn't capable of determining whether an image is portrait or landscape oriented. Scripts, on the other hand, can be written to handle such jobs. A script can get information, evaluate that information and perform calculations, and make decisions based on the information. Actions, on the other hand, are "dumb"they can perform only the same steps and settings with which they were recorded.
Virtually every aspect of Photoshop, Illustrator, and InDesign can be controlled through scripting. Visual Basic and AppleScript can call programs outside of the program within which you're running the script. Running a script in Photoshop could, for example, open Illustrator, find a specific piece of artwork, copy it, switch back to Photoshop, paste the artwork, save the file in a format appropriate for print, open InDesign, add the Photoshop file to a document, save the document, and print the proof. In a nutshell, if you can do it using the keyboard and mouse, it can probably be recorded in Visual Basic or AppleScript. And don't overlook the fact that a script can play an action within Photoshop or Illustrator.
Scripting Resources Supplied with the Adobe Creative Suite
Each of the scriptable members of the Adobe Creative Suite (Photoshop, Illustrator, and InDesign) has some scripts included with the program, as well as additional resources and information either on CD or available through www.adobe.com.
Photoshop CS2 Scripts
Remember, too, that resources are available to you at www.adobe.com in the Expert Centers for each product. You also find assistance and information in the various scripting forums within the product forums of www.adobe.com.
The sample scripts mentioned earlier can be added to Photoshop as long as you know where to put them. You can load a script for use one time, or copy them to the Scripts directory to put them under the Scripts menu the next time you launch Photoshop. Choose File, Scripts, Browse. From here you can browse to the Sample Scripts folder in the Scripting Guide folder. Select the ExecuteMoltenLead.jsx script and click Load. A new layer of molten lead is created by the script. If you don't have a document open, the script creates a new document for you and emblazons it with lead. You can put any of these sample scripts permanently under the Script menu. Copy the JSX files to your Presets, Scripts folder in the Photoshop CS2 folder. Close and relaunch Photoshop, and look under the File, Scripts menu for your sample scripts to appear in the list. For more scripts go to http://share.studio.adobe.com.
Learning More About Scripting…
Here are some online resources you can use to learn more about scripting:
The Internet is just one source of information on scripting. Especially if you're new to high-level automation, check out these additional resources: