Adding User Interaction to an Action
Once you’ve created a few simple actions like the one we’ve just recorded, you may encounter a situation in which you want the ability to interact with the action. When you’re running the action, for example, you may want to open a file on which to run the action, or you may want to resize the image at some point in the process. To open a dialog box while an action is running and have it pause until a choice is made, use the Insert Menu Item option on the Actions palette menu. This option lets you force a dialog box to open at a defined point in the action so that you can make a selection from it. Then, when the dialog box is closed, the action will continue to execute from that point forward.
The following step-by-step example shows how to stop the action to open a file and stop it again later to resize the image.
Creating a Polaroid Photo Action
In this action, you’ll add a narrow border around an image and add a shadow effect to resemble a Polaroid photo. Follow these steps:
- Open an image to use purely for the purposes of recording the action. The image should have only a background layer. From the Actions palette menu, choose New Action; then type a name for your action and click the Record button.
- From the Actions palette menu, choose Insert Menu Item to open the Insert Menu Item dialog box. From the Photoshop menu, choose File > Open; the entry file: open will appear in the Insert Menu Item dialog box. Click OK to close this dialog box.
- To ensure that you’re working from a layer and not the image background, choose Layer > New > Layer from Background and click OK.
- To pause to allow the image to be resized, choose Insert Menu Item from the Actions palette menu. From the program menu, choose Image > Image Size. Click the OK button in the Insert Menu Item dialog box.
- Add an inner shadow and inner glow layer style to this layer, using Layer > Layer Style > Inner Shadow.
- From the menu, choose Image > Canvas Size. Set the Width to 10% and the Height to 5%; then enable the Relative checkbox and click the middle bottom of the nine items in the Anchor area. Click OK and extra space will be added around the top, left, and right of the image. Choose Image > Canvas Size again; this time, set the Height value to 15%, enable the Relative checkbox, and click the top middle of the nine anchor items so that the extra image canvas is added to the bottom of the image. Click OK.
- Choose Layer > New > Layer and click OK to add a new layer to the image. Place this layer below the current layer by pressing Ctrl+[ (Command+[ on the Mac). Fill the layer with an off-white color using Edit > Fill.
- When you’re done, click the Stop Playing/Recording option and test the action on a new image as shown in Figure 10.
Figure 10 This action creates a Polaroid frame effect around an image of your choice.