Actions & Scripts

The Photoshop user community is large and it includes some very capable and generous people who have created clever automations that extend Photoshop beyond what the team has created. These automations can take a couple of forms: actions, which most users can make, or scripts, which require real programming knowledge to create, but not to use.

In this section, I’d like to briefly introduce you to both. No, we won’t be creating any scripts because this isn’t a programming manual. But I will discuss how to create and use actions, as well as where to find and how to use scripts.

Actions

To create or run an action, you’ll need the Actions panel. There you’ll see a default Set (folder), unsurprisingly called Default Actions. Sadly, they’re not very useful. The most practical actions are those that reliably and quickly perform a series of tedious tasks so you don’t have to.

Consider this scenario: you’re faced with a few hundred images that all need the same multi-step treatment. Perhaps they all need to be cropped to a square format, have their vibrance increased by the same amount, and vignetted so they are darker at the edges. The first step may need intervention to choose which square area is retained.

The process of “recording” would go something like this:

  • Open an image that is a good representative of the rest.
  • Set the ruler units to percent to be as flexible as possible, especially if images can be vertical or horizontal.
  • In the Actions panel, create a New Set (see figure) to separate your useful actions from the less useful defaults.
  • Create a new action by clicking the new action button (). Give the action a name (for the task above, I’d go with “vignetted squares”).
  • When you commit the name, your new action is being recorded. Almost everything you do will become part of the action, so try not to do anything extraneous. While the action is recording, the small circular icon at the bottom of the Actions panel will be red. Click the square stop button to its left to stop recording. Click the circle again to resume.
  • Where user interaction or judgment is required, you can allow that. After you complete recording, click the square to the left of the step in the action that needs a human touch. When played back, the action will pause until the user commits the function. Cropping, transforms, and filter dialog boxes are good examples.
What’s Recordable?

Actual edits. That means zooming (including the Fit on Screen command) is not recorded. Using the Actions panel menu, however, you can choose to insert menu commands and more.

There are many items in the Actions panel menu. Insert Menu Item… gives you a moment to choose one. When an action does resizing, for example, I often like it to end with the image at a viewable size, so I’ll use Insert Menu Item… to insert View > Fit on Screen.

Insert Stop… inserts a dialog box of your own to notify the user that they’re expected to do something in the next step, perhaps, and to give brief instruction. The Allow Continue checkbox will cause a Continue button to appear in the dialog box so the action can continue after the user sees the dialog box. Otherwise, the action stops at the next step and can be resumed only by pressing the play button.

A classic benefit of programming is “if—then—else.” That is, if a certain condition is true, then perform a certain action, else (otherwise) perform a different action. Insert Conditional… provides that programming nicety with its own list of conditions to evaluate. You choose a condition to evaluate, then other actions you’ve recorded that can be played if the condition is true or not. To this end, many users like me record many short actions that do only one or two things. We can then call upon them via a conditional in another action.

Playback Options… are useful too. When testing your action (yes, you very certainly should test your action with several images of varying size and shape), you can set playback to be slow enough to see each step. That way, if something goes wrong, you are likely to see at which step it happens. Return playback speed to Accelerated when it’s ready for production.

The last items in the Actions panel menu are other sets of actions. Some of these may actually be useful, although most use older techniques that may no longer be considered best practices.

I used actions extensively in the preparation of the screenshots that appear in this book. They clean up extraneous layers that my screenshot software introduces, convert to the appropriate color space, set resolution, trim excess image from beyond the useful parts, and more.

It takes every user many attempts to become adept with actions. The mistakes you make will be learning opportunities, however, so try to relish them. If I’m any good at recording actions, it’s because I’ve made literally thousands of mistakes along the way.

Scripts

These bits of code are “proper” programming with “if—thens” and much more. A number of scripts are to be found within Photoshop itself, or are used to move images from Adobe Bridge to Photoshop with some processing along the way.

Supplied Scripts

In Photoshop’s File menu, you’ll find scripts in the Scripts submenu, of course, and also in the Automate submenu. For example, the Photomerge script is what we use to create panoramic images. It automates the process by performing many separate Photoshop tasks in a way beyond what an action can achieve.

And that’s the point: scripts are telling the application to do things it already does, but in an order and with settings such that it feels like a wholly new feature.

Scripting Guide

Adobe provides scripting guides at:

https://www.adobe.com/devnet/photoshop/scripting.html

If you have experience with scripting languages, you might try your hand at crafting your own, and these resources will help.

Bridge Scripts

When we use Adobe Bridge to gather a number of images together, we can use scripts we find there to batch process them. From Photoshop, choose File > Browse in Bridge…. Once in Bridge, you can get to scripts by choosing Tools > Photoshop. Yes, they’re mainly the same scripts we see in Photoshop. But it’s often easier to select the images we want to process in Bridge rather than try to pull them into Photoshop or have dozens open at once. With Bridge, we can select hundreds of images and have Photoshop process them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset