You can create your own action simply by recording it. In many cases, it's best to first record a "rough draft" of an action, and then fine-tune it after it's recorded. To show you how this works, I'll build an action for something I do often: preparing an image for the Web. You might ask if that's too simple of a task to turn into an action, but doing a good job of sending an image to the Web involves more than just choosing Save for Web. I often need to convert images from many different sources, which means they may not be at the right size or color space for the Web. The action I use can take all kinds of images and conform them to my Web specifications.
To record a new action:
If you want to create a new action set for the action, click the Create New Set button at the bottom of the Actions palette (Figure 17.4), name the set, and click OK.
In the Actions palette, select an action set to contain the new action.
Click the Create New Action button (Figure 17.4).
Name the action, and click OK (Figure 17.5).
Click the Begin Recording button.
Perform the steps required to complete the action. (Some things you do in Photoshop can't be recorded, such as brush strokes or path drawing. See the next section, "What You Can and Can't Record.")
As you record an action, it's a good idea to keep an eye on the Actions palette to make sure steps are added as you expect. If you do something and it isn't added to the action, you may have done something that isn't recordable, or the document is already in the state you're trying to apply (for example, choosing Image > Mode > CMYK Color has no effect if the document is already in CMYK mode). You can still add commands that aren't recordable by using the Insert Menu Item command; see the next section.
When you complete all the steps you want to record, click the Stop Playing/Recording button (Figure 17.6). You don't have to record the entire action at once; you can stop and start recording as needed.
If you make a minor mistake while recording an action, you usually don't have to start over. It's easy to edit actions, so keep going if possible and just edit the incorrect step later (see the upcoming section, "Editing Actions.")
Photoshop saves actions only when you exit the program. If Photoshop were to crash, you'd lose any actions you made in the current session. (This is also true for preferences.) If you've recorded or edited actions that required a lot of work to create, exit Photoshop purely to ensure the actions are saved, or remember to save the action set by choosing Save Actions from the Actions palette menu.
If you want to build an action but aren't quite sure how to approach it, try examining the actions that come with Photoshop. They may contain useful examples.
What You Can and Can't Record
You can record any step that involves concrete values, such as applying a dialog box, transforming (moving, resizing, and so on), or changing values in the options bar or in a palette.
You can't record brush strokes (including strokes by image-correction brushes like the healing brush, dodge and burn, and rubber stamp), path drawing or editing steps (such as drawing with the pen tool), or commands that appear on the View menu or Window menu. However, you can save freeform selections, such as those you create with the lasso tool.
If an action requires painting, drawing, or manual retouching, you can choose Insert Stop from the Actions palette menu and type instructions for the person using the action, telling them what to do at that point.
Although you can't record view changes, there is a way to add some view changes to an action, because you can add any menu item to an action using the Insert Menu Item command. The Insert Menu Item command is also a way to add a command to an action when for some reason a command wasn't added to an action when you were recording.
To add any command:
In the Actions palette, select the action step before the place where you want to add the menu item.
Choose Insert Menu Item from the Actions palette menu.
Choose the command you want to add. You can choose commands from the menu bar or from a palette menu (the round button in the top-right corner of a palette), but not pop-up menus in palettes.
The Insert Menu Item command is also useful when you want to open a dialog box at its default values, instead of the values that were used when you recorded the action.
Opening and Saving Documents in Actions
Although in many cases you may run an action on an open document, you may want to design an action that opens a document. It can be tricky to open and save documents in actions, because filenames and folder paths are involved. The problem with recording the Open command is that you record opening one specific documentwhen you play it back, it will always open the same document. If you want an action to open a set of documents that aren't open, use the Batch dialog box (Chapter 18) with the source set to a folder or selected documents in Bridge.
Saving new documents is slightly less tricky. When recording an action that includes the Save As dialog box, touch only the options you actually want to change. Options you don't change take on the document's existing settings. For example, suppose you want an action to alter documents and then save the altered versions as JPEG documents in a new location without renaming them. To achieve that goal, you would record choosing File > Save As, changing the format and folder location, but leaving the filename untouched.
If you edit the filename while recording the action, the action records the new filename and gives it to all processed imagesproducing one document that's continually overwritten by each subsequent file, instead of a number of uniquely named documents.
When including the Save As command in an action, specify a folder location that's always going to be there. If the folder recorded in a Save As step isn't there or was renamed, an action will fail. For actions that I use all the time, I have a permanently designated output folder on my hard disk, and that's where the action's Save As step is pointed. Another advantage of a permanent output folder is that it can serve as an intermediate checkpoint where you can verify that the documents the action produced are correct. If they are, you can then move those documents to their final destination. If they aren't, you throw them out, adjust the action, and try again.
Actions do exactly what you tell them to do. When an action is properly made, you can create 100 perfect documents very quickly. On the flip side, if your action contains an error, it's going to produce 100 documents worth of garbage. Before you use an action for actual production work, test it. Use expendable test documents in a test folder. Also, make sure your test files represent the range of documents you'll actually use. You might try different document sizes, or documents saved in different locations.
If you're having a problem with an action and you're trying to identify the problem itself, you can change the playback speed. To change how the action plays back:
Choose Playback Options from the Actions palette menu.
Select Step by Step to see more clearly what happens at each step; or select Pause and enter a time interval for Photoshop to pause after each step (Figure 17.7).
If you need a more specific indication of an action's playback progress as you debug it, you can insert alert dialog boxes near the steps in question. The dialog box pops up at its point in the sequence.
To add a dialog box to an action:
In the Actions palette, select the step before the place where you want to add the dialog box.
Choose Insert Stop from the Actions palette menu.
Enable the Allow Continue checkbox. If you enable Allow Continue, when the dialog box appears it displays Stop and Continue buttons. If you disable Allow Continue, the dialog box displays just a Stop button and you won't have a way to continue testing the action any further (Figure 17.8).
If you want to display a message in the dialog box, enter it.
It's a good idea for the first step in an action to save a snapshot in the History palette so that it's easy to return to the state of the document before you ran the action. This is especially useful when an action hasn't yet been fully tested. The actions that come with Photoshop create a history snapshot as a first step.