Getting Started: Setting Up Alternative Actions
This is the fourth workflow from the Getting Started guides available for Alfred 5's Workflows. Start with the First guide if this is new to you.
With this fourth guide, we'll take a look at some more useful workflow features; Prefabs and Alternative Actions.
Creating your workflow
Create a new blank workflow or continue using the one you created at the start of this series of Getting Started Guides.
Add the File Filter workflow Prefab
From the Palette, drag in the File Filter workflow object in the sidebar.
Unlike the individual objects we've added before, this one added three pre-configured objects instead; This is a Prefab.
To create and save your own Prefabs, first configure your object(s) in the canvas, connecting and annotating them as necessary.
To save them as a Prefab, highlight the object(s) on the canvas and:
- Right-click the group of objects and choose "Save as Prefab..."
- or click the + in the Prefabs header of the Palette.
You'll need to give your Prefab a name and, optionally, a description to make it easy to choose later.
It'll then be saved under the Prefabs section of the Palette, ready for you to add at any time.
Now, let's get back to our tutorial!
Set the Alternative Action
Currently, our workflow is set to perform both actions when the img
keyword is used, but that's not quite what we want to do; We want the Reveal in Finder action to be performed only when holding a modifier key.
Double-click the circle along the line to the blue object to configure it.
Check the box for "Command" and set the Subtext to "Reveal in Finder", then click the Save button.
You've now set your alternative action and the workflow is ready to use; The alternative action is denoted by the modifier key (in this case the ⌘
symbol) in the middle of the connection between the File Filter and the Reveal File in Finder object.
Using your new workflow
Type img
to do an image search;
- Press Return to open the file
- Hold
⌘
and press Return to perform the alternative action and reveal the file in Finder instead.
Notice how the subtext shows "Reveal in Finder" instead of the path to the image when ⌘
is held?
You've now completed the Getting Started Guides!
The final guide will provide you with links to learn more about Alfred.
Further uses for Alternative Actions
Alternative Actions are very useful when you only want to remember one keyword, but may want to take a few different actions on the output.
- Open a link in a secondary web browser instead of your default one
- Run a different script when the modifier is held
- Automatically paste to the frontmost app instead of simply copying to clipboard when holding the modifier
Did you know that Alfred has built-in alternative actions for your default results too?