Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From \$16.50/m

# Exploring Alfred's Latest Features

Difficulty:BeginnerLength:MediumLanguages:

With Alfred 3‘s’ release in May of 2016, it came with many new features. I covered most of them in the Alfred 3 Explained—Part 1 and Alfred 3 Explained—Part 2 tutorials. Since then, Alfred has had several updates that gives even more abilities to this application.

## Workflow Creation Helpers

Alfred workflow area has a nice new feature: it helps you create new blocks while clicking on a block.

By right clicking on a block, a submenu comes up that allows you to select a new block before or after the current block. You can also replace the current block with a different block. Since it keeps the interconnecting lines in place, this can save some time.

## Cursor Placement

Ever since Alfred added text expansions in version 3.0, people have been asking for cursor placement ability. This is simply a macro that will mark the location of the cursor after pasting. This is generally done by pushing back arrow keys to the keyboard buffer to place the cursor at the correct location.

Alfred has given this ability to both text expansions and in clipboard pasting. That means you can add cursor placement to a workflow that pastes text to the topmost application. You place the {cursor} macro where ever you want the cursor placed.

I use this text expansion to tell someone on a Trello card Thanks!. It leaves the cursor just after the @ symbol so that I can start typing the name. Now it’s quick and easy to be polite.

This feature also works in the auto-paste option for the Copy to Clipboard block.

You can create text with a script, set the {cursor} macro, and then send it to the Copy to Clipboard block with Automatically Paste to Frontmost App selected. Alfred will paste the text and then move the cursor to the correct position. This doesn’t work right in Alfred 3.2, but works fine in Alfred 3.2.1.

The workflow in the download has the command ta3:cursorplacement which places the cursor at a place before the query string. You place the {cursor} macro in a Script block and passed to the Copy to Clipboard block for pasting and moving the cursor. I’ve incorporated this feature into my Quiver Workflow.

## HotKey Getting Application Bundle ID

The Hotkey block now has a new extended option in the Related Apps tab.

By checking the Focused App Variable and supplying a name, the topmost focused application will have it’s bundle ID passed in the given variable.

If you do not add a variable name, it will default to focusedapp as the variable name. This greatly simplified my QuickEdit workflow.

In the workflow given in the download for this tutorial, there is the Hotkey block. You will have to assign the hotkey yourself when you install the workflow.

When you activate the hotkey, the bundle id of that program will show up in a user notification.

## Changes to Script Filters

The neatest new feature in Alfred 3.2 is the ability to pass variables from one execution of a Script Filter block to the next, and the ability to re-evaluate the script in a Script Filter after a delay.

Both of these are accomplished by an extension of the JSON or XML structure passed from the script. The new JSON structure is:

The rerun items tells how many seconds to wait for re-runing the script. The variables structure can have as many variables and their values assigned as you need.

The items structure has the added values of mods and text. The mods allow you to change any of the item variables if the modifier key is presses.

The text structure allows you to put specific text in the clipboard with the copy key, and display specific text in large type with the largetype key. When the user presses Command-C on an item, that items copy text gets placed in the clipboard.

When the user presses Command-I on an item, the specified text gets displayed in large type on the screen.

The XML version is:

The Alfred team wants all new workflows to just use the JSON output formatting since it is the fastest to parse. Alfred still accepts the XML version.

The workflow in the download has the command ta3:top that will show the top five processes that is using CPU time. It will automatically update each second and gives a seconds count with whatever the user types into the prompt.

This shows how you can make use of many of the new features for Script Filters.

## Calling External Triggers Block

Alfred now has a block for easily calling external triggers in other workflows.

In this block, set the Workflow ID of the workflow you want to trigger an external trigger.

The self name will trigger one in the current workflow. After you set the Workflow ID, add the Trigger ID by clicking the Workflow Triggers... button that will list all the external triggers for the specified workflow.

Set the Pass input as argument checkbox to send the input to this block as the argument for the trigger. If you check the Pass variables flag, it sets all the environment and global variables into environment variables for the calling workflow.

By using this new block, you can create workflows that call other workflows without having to make sure your script is calling the latest version of Alfred. This was a major issue moving Alfred 2 workflows to Alfred 3.

## Hide Alfred Block

Sometimes you need the Alfred Prompt to go away faster. By using the Hide Alfred block, the Alfred Prompt will close quicker.

This new block is in the Utilities submenu when you right click on the background. It is a small box with the Alfred Hat a gray color.

This block allows you to connect to the front and then from the back to the next block.

## Dispatch Key Combo Block

Another useful block is the Key Combo Block.

The Dispatch Key Combo is in the Outputs submenu when you primary-click on the background.

You click on the Key Combo box and then press the keys you want to use. When your workflow runs this block, it will simulate the specified key press. I find this very useful for automating other programs with an Alfred workflow.

## Playing Sounds

The last new block is the Play Sound block.

This block is in the Outputs submenu as well.

By clicking on the Sound drop-down list, you can select from one of the sounds that come with Alfred. You can also select any .aif or .m4a files in the workflow directory.

You can get more sounds from Alfred Labs on their website. Just download those sounds, copy the one you want to use to your workflows directory, and you can select it in the Play Sound block. The download contains 31 sounds to use.

Whenever the block is run, it will play the selected sound. Therefore, you can give audio feedback to the user on the progression of your workflows.

## Conclusion

Alfred is an application that continues to grow and create more useful workflows for automating your work. Take advantage of these new features and see what type of workflows you can create. I’m making good use of the extensions to Script Filters.