Our Sponsors

Action Directory
Connect with Us
Blog Index

Launch iOS Actions from the Mac using Alfred and Command-C

In my first post about Command-C last week, I haven't really explored into the possibilities of sending data from Mac to iOS. After spending a few days learning AppleScript the hard (and maybe, wrong) way, I'm finally ready to share a few Alfred workflows that you can use to send data and trigger actions on your iOS apps.

The basic idea is pretty straightforward. On iOS, we store our custom URL actions in Drafts or Launch Center Pro. We need to find a similar place where we can store our custom URL actions. My choice is to go with Alfred. You are welcome to create similar approaches with other launcher Mac apps, such as Launch Bar, Quicksilver, and Keyboard Maestro.

Alfred 2 Power Pack allows users to create their own custom workflows.

Alfred 2 and its Power Pack

To install and run the actions in this post, you need to download Alfred 2, and purchase its Power Pack. You need the Power Pack to create and install custom workflows.

I have created a bundle where you can download all of the custom workflows I outline in this post. If this is the first time you install a custom Alfred workflow, simply double tap on the file in Finder, and it will automatically be added onto your copy of Alfred.

From Alfred to Drafts

By now, I'm sure you know that Command-C can send text/images from Mac to iOS. The problem with this built-in feature is the clipboard data still floats around the iOS pasteboard. What if we could put the clipboard data, assuming it's in text format, straight into Drafts instead?

To do this, we need to use the copyAndOpenURL action from Command-C. And, instead of sending just a string of text, we will send a Drafts URL Scheme instead. We can write the URL Scheme to create a new post in Drafts containing the text that's being sent from Alfred prompt.

But, we don't need to stop here. We can go even further by triggering any action that we already have installed in Drafts. All we need to do is define a delimiter to split the text we put in Alfred prompt into the text and action parameters of the URL Scheme.

Since the Drafts URL Scheme will be invoked after the copyAndOpenURL action of Command-C (as the x-success argument of the URL), we need to double-encode it.

Here's the AppleScript that I created with the help of Phillip Gruneich and the explode script from Brati's Lover. After you download the workflow, you may need to change the device name to your primary iOS device name. If you want the script to handle more than one iOS device, you may need to modify it.

I use the drafts keyword as the input trigger for this workflow. You can type either drafts %1 or drafts %1; %2 in Alfred prompt to trigger the action. The first version will only copy the first argument as text into Drafts, whereas the second version allows you to define the action name (as the second argument) that you want Drafts to trigger on the first argument. My script uses ; as the delimiter, but you're welcome to change it with your preferred delimiter. Because Alfred treats the entire string (including all the delimiters) as a single string of text, you can send a very long text with many white spaces within it.

Clipping Quotes from Safari to Quotebook

I love to collect quotes from articles that I read. Even though Quotebook hasn't really been updated in a long time, it's still able to get the job done. Having a URL Scheme really helps too.

This next workflow allows me to pull a quote from an article opened in Safari into the clipboard, and type quote <author-name> in the Alfred prompt. The AppleScript will automatically retrieve the URL of the current active tab in Safari and use it as the quote source.

Adding Todo Items from Alfred

The next use case shows an example of how you could add a new todo item from Alfred to your favourite iOS todo app that supports URL Scheme. If you use Silo or Clear, you should definitely try their Mac apps before attempting to create workflows similar to this. But, if you use Begin (or any other iOS-only app), you may find this workflow convenient.

This example shows how you can create your own workflows in Alfred to send data and/or trigger actions in your favourite iOS apps. Even though this technique works for all iOS apps with URL Schemes, such as Due and Fantastical, I'd recommend you check out and consider using their Mac apps too.

Adding Journal Reminders to 1Writer

This use case deserves a bit of explanation because I've never written about it previously. I use Day One to write my personal reflection journal. Instead of trying remember what I want to write at the end of each day, I add reminders about the small bits that I want to write in longer form later.

Previously, I have used Drafts and Due to remind me of these journal items. Then, Launch Center Pro 2.0 came up with labeled [prompt] tag that made it easier to trigger actions with multiple fields. So, I moved my action from Drafts to Launch Center Pro. But then I started to explore 1Writer, and its ability to append a named document makes it a better place for these journal reminders.

So, I created this action in Drafts to append a new journal item into the file named Journal Items.md which is saved locally in 1Writer. I used David Sparks's TextExpander date/time snippets to add a timestamp for that item. Then, when I want to start writing my daily journal in Day One, I just need to open 1Writer, select the items that I want to export and share it to a new post in Day One. To do this, I use the Send to Day One action from 1Writer's official Action Directory.

Open this link to automatically install this action on Drafts on your iOS device.

And, here's the ActionScript that will convert the parameter sent via Alfred prompt into 1Writer.

More Examples of iOS-only Apps

Without rehashing everything, here are two more workflows that I create as examples for utilising Alfred/Command-C combination to trigger actions in iOS-only apps. The first app is Momento, a personal journaling app that I've been using for more than three years. And, the second app is Felix, a great App.net client for iOS - that should fit the gap of high-quality App.net client for the Mac.

Open Current Active Tab on Safari in 1Password's Browser on iOS

In case you haven't noticed, I hosted this site on Squarespace 5. Each time I want to publish a post, I always publish it as a draft first. Then, I open the draft on my iPhone to test all the links (especially the import action links). To access the draft, I need to login to my Squarespace account, before submitting the URL of the draft preview page that I want to test. While doing this on the Mac is quite simple, I need to do this on the iPhone as well (due to the import action links).

With this AppleScript, I can use 1Password's browser on iOS to open a draft preview page in Squarespace without having to go through the login page. To make it even better, I can open the draft preview page in Safari on the Mac, and trigger 1pbrowse to open the same page inside 1Password's browser on my iPhone.

This last example really makes things easier for me. Throughout the process of writing this post, I use this many times to check on the draft preview page.

Alfred workflows can be packaged into a bundle that makes it easier to distribute them.


To be able to send data and trigger actions from Mac to iOS is an awesome feeling. You really need to give these workflows a try. I hope this can inspire you to explore the Alfred/Command-C combination and create new and exciting stuff that weren't possible previously.

You should follow me on Twitter here.

« Launch Center Pro 2.2 Update | Main | How Command-C Replaces Pastebot and Improves My Workflow »
Real Time Web Analytics