Sub topic 6
Inserting stops, menu items and paths
This chapter assumes you can record a basic action, edit it in the Actions panel, and save it in an action set. It also assumes you know what a modal control is. If those are new, review the earlier chapters on recording and editing first.
Recording captures what you do. Some things can't be captured that way, or can't be captured reliably. The Actions panel menu has three commands for those gaps: Insert Menu Item, Insert Stop and Insert Path. They add steps that you could not have recorded by doing the work.
What the three commands add
| Command | What it adds to the action | Typical use |
|---|---|---|
| Insert Menu Item | A step that runs a chosen menu command | Menu commands that don't record, such as View settings or some tool-related commands |
| Insert Stop | A pause with a message | Instructions for the user, or a point where the user must do manual work |
| Insert Path | A stored path from the Paths panel | Reusing a vector shape or a selection outline inside an action |
All three work on the currently selected step. The new step goes after the selected step. This detail causes most placement errors, so select the right step before you insert.
Insert Menu Item
Some menu commands do nothing when you choose them during recording. Others record only part of what you want. Insert Menu Item adds the command by name instead.
- Select the step in the action after which the command should run.
- Open the Actions panel menu and choose Insert Menu Item.
- With the dialog open, choose the menu command from the Photoshop menus. Photoshop fills in the command's name.
- Click OK.
The inserted step is listed as the menu command and runs when the action reaches it. Keep these points in mind.
- It does not record settings. The command runs the way it would if you picked it from the menu. If it opens a dialog, that dialog appears during playback and waits for input. The step does not store the values you would type in.
- It depends on context. If the command is unavailable at that point (for example, a layer command with no suitable layer), the action stops with an error.
- Menu names can change. An action that relies on a command's name may fail in a different Photoshop version or language if the command is renamed or moved.
Because an inserted menu item has no stored settings, it fits best for commands that need none, or for commands where you want the dialog to appear and the user to decide.
Insert Stop
A stop pauses playback and shows a message. Use it for three jobs:
- Tell the user what to do ("Draw a selection around the product, then click Continue").
- Let the user do something that can't be recorded, such as painting with a brush.
- Warn about a condition ("This action expects a flattened image").
To add one:
- Select the step after which the pause should happen.
- Choose Insert Stop from the Actions panel menu.
- Type the message.
- Optionally select Allow Continue. This adds a Continue button to the message.
- Click OK.
Allow Continue
The Allow Continue setting decides what happens after the message appears.
- With Allow Continue on, the message shows both Continue and Stop buttons. The user does the manual work, then clicks Continue and the action resumes at the next step.
- With Allow Continue off, only Stop is offered. Playback ends. This is right for a message such as "Open a file before running this action", where continuing would be pointless.
You can change a stop later by double-clicking it in the action and editing the message or the Allow Continue box.
How stops behave in a batch
Stops are meant for people. In a batch run, a stop shows its message for every file, and the run waits for someone to click. With Allow Continue off, the stop ends the action for that file and can halt the batch. For an unattended run, you have two choices:
- Remove the stop before the batch.
- Use a copy of the action without stops for batch work, and keep the interactive version for hand use.
The Batch dialog has a Suppress File Open Options Dialogs setting and an Override Action "Open" Commands setting. Neither affects stops. A stop in a batch always shows.
A stop is a poor substitute for a modal control (the dialog toggle covered in the editing chapter). Use a modal control when you want a command's own dialog to appear so the user can enter values. Use a stop when the user must do something outside any dialog, or must read an instruction.
Insert Path
Insert Path adds a path from the Paths panel to the action. During playback, the path is recreated in the document.
- Make the path active in the Paths panel. A saved path, a work path, or a vector mask path can be selected.
- In the Actions panel, select the step after which the path should be added.
- Choose Insert Path from the Actions panel menu.
The path is stored in the action. When the action plays, Photoshop adds that path to the target document as a work path. Later steps can then use it, for example by turning it into a selection, filling it, or stroking it.
Why paths need this command
Recording a path-drawing session captures only some of what you did. The Pen tool's work is not reliably recorded as a path you can replay. Insert Path stores the finished path itself, which is the dependable way to reuse a shape.
Limits of stored paths
A stored path has fixed coordinates. That has consequences.
- It does not scale. If the action runs on a document of a different size, the path lands at the same coordinates, not in the same relative position. On a smaller image it may fall partly or entirely outside the canvas.
- It is stored in the action. Large or complex paths make the action file bigger.
- It replaces nothing on its own. Each play adds a work path. Later steps must use it right away, because a new work path replaces the previous one.
For batch work across images of different sizes, a stored path is only safe when the images share dimensions, or when an earlier step resizes or crops each image to a known size first. The chapter on making actions portable covers how to build that standardizing step.
A worked example
This example builds a small action called "Frame check" that combines all three commands. The goal is an action that places a fixed circular path, then asks the user to verify before filling it.
- Open a 1000 × 1000 px image.
- Draw a circle with the Ellipse tool in Path mode. In the Paths panel, you now see a work path.
- Create a new action named Frame check and start recording.
- Make a trivial recorded step, such as selecting the background layer, so the action has a step to anchor to. Stop recording.
- Select that step. Make sure the circle path is still active in the Paths panel, then choose Insert Path.
- With the path step selected, choose Insert Stop. Enter "Check that the circle sits inside the frame. Click Continue to fill it." and select Allow Continue.
- Select the stop. Choose Insert Menu Item, then pick Select > Deselect from the Select menu, so the action leaves no selection behind.
The result is a short sequence:
Run the action on a 1000 × 1000 px image and the circle appears where you drew it. Run it on a 400 × 400 px image and the circle runs off the canvas. The stop is where you would notice that. In a batch, nobody is there to notice, which is why the stop also shows why this design suits manual use more than batch use.
Choosing between the three
Use these rules when deciding how to handle a step that won't record.
- The step is a menu command that needs no settings. Use Insert Menu Item.
- The step needs human judgment or manual work. Use Insert Stop with Allow Continue.
- The step needs a fixed shape, and image sizes are known. Use Insert Path.
- The step needs the command's dialog. Turn on that step's modal control instead.
- None of these fit. The step probably belongs in a script, covered in the last chapter.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| New step appears in the wrong place | Wrong step was selected when inserting | Drag the step to the right position in the action |
| Batch stalls on every file | Action contains a stop | Remove it, or use a stop-free copy |
| Path is off-canvas on some images | Stored path uses fixed coordinates | Resize or crop to a standard size first |
| Insert Path is unavailable | No path is active in the Paths panel | Select the path, then try again |
| Menu item step errors during playback | Command unavailable in the current context | Add or record the steps that prepare the document |
| Inserted menu command opens a dialog nobody expected | The step stores no values | Record the command normally, or accept the dialog |
Exercise
You built an action for product photos. It contains an inserted path that outlines the product, followed by a stop that says "Adjust the path if needed" with Allow Continue turned on. You now want to run it unattended on 500 files of varying sizes. Name two separate problems this causes and one fix for each.
Show answer
First, the stop pauses the run for every file and waits for a click, so the batch will not finish unattended. Fix: remove the stop, or use a copy of the action without it. Second, the stored path has fixed coordinates, so it will not fit images of different sizes and may land off the canvas. Fix: add a step before the path that resizes or crops every image to a standard size, or avoid the stored path and use a method that adapts to each image.
Exercise
You insert a menu item for Image > Image Size and play the action. What happens, and what would you do to make the action resize silently to a fixed width?
Show answer
The Image Size dialog opens during playback and waits for input, because Insert Menu Item stores only the command, not its values. To resize silently, record the Image Size command normally while performing it with the desired values, so the settings are stored in the step.