How To Automate Anything With Alfred Workflows


Last month, Mac application launcher Alfred updated with a lot of improvements. The most interesting feature is the new Workflows system that makes it easy for you to create your own speed-boosting shortcuts.

The addition of Workflows into Alfred seems minor at a glance, but they allow you to do all sorts of productive things (note: while Alfred is free, workflows require the powerpack for about $US21) easily with hardly any coding skills at all. The best part is they’re not stuck on your computer, you can share them with people, and download other people’s workflows to use for yourself. One of my favourites is a set of Spotify controls that allows you to quickly search for and play tracks without ever actually opening the Spotify window.

So, let’s take a look at how to get started with your own workflows before we do a little show and tell.

How to Make Your Own Alfred Workflows


Workflows are a little confusing at a glance, but they’re actually very simple when you start messing around with them. A workflow is broken down into four parts:

  • Triggers: Usually a system-wide hotkey, but this can also include when you access a file or folder.
  • Inputs: These are the keywords you type into Alfred. They can also include file filters.
  • Actions: Actions are the scripts that run after you type in the input. This can include loading an AppleScript, launching an application, opening a web site, and more.
  • Outputs: Outputs are exactly what you’d expect. These include something getting copied to the clipboard, a notification posting, or a script running.

Alfred includes a bunch of sample workflows that are worth looking at to get an idea of how they work, but lets go ahead and make a very simple workflow to temporarily pause iTunes:

  1. Open Alfred’s preferences and click on “Workflows.”
  2. Create a new workflow by clicking the “+” sign, and select “Blank workflow.”
  3. Name the workflow iTunes Pause (or whatever you want) and click Ok.
  4. Click the “+” in the workflows upper right corner, and select “Triggers,” and then “Hotkey.”
  5. Enter whatever hotkey you want (I did Shift+Command+P) and click Ok.
  6. Click the plus arrow and again, select “Actions” and select “Run NSAppleScript.”
  7. Paste this code into the AppleScript box:
    on alfred_script(q)
    tell application "iTunes"
    pause
    delay 180
    play
    end tell
    end alfred_script

    and click “OK”.

  8. Now, mouse over the hotkey, and click on the tab on the right. Drag the arrow over to the AppleScript box.

Congratulations, you just made your first workflow! You can now click the “Share” button in the bottom left corner to export the file, and send it over to anyone you want.

Share Your Workflows

The process can be as simple as above for a quick hotkey to trigger an AppleScript, or you can make it much more complicated by creating your own search structures with PHP. Of course, the best part is that you can benefit from other people’s hard work easily, and you can browse through a lot of what’s been created so far over on the Alfred forums. If you’re ever curious how a workflow works, you can ask in the forums, or just install it in Alfred and double click any of the nodes to see the code.


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


Leave a Reply