iOS workflows for org-mode

Although MobileOrg is a very interesting project, I don't find it very attractive compared to many other iOS productivity applications. It is indeed handy when I need to search something that I know I stored in org, but there are much better option to quickly capture ideas and tasks. This said, it is not difficult to hack into the org-mobile architecture, sharing the sync stuff already in place for MobileOrg (I used Dropbox for that).

I have started hacking some simple workflow to help me quickly enter notes and tasks into org, and to add URLs that I want to check out later. I use the following tools:

  • Pythonista: A great tool, incredibly well thought and implemented. Basically, it is a fully functional python IDE, very well integrated into iOS. Worth its price in gold!
  • Drafts: A plain text and Markdown editor, very much oriented toward automation. Drafts makes it very easy to interact with files stored on Dropbox.
  • Launch Center Pro: Not strictly necessary, but it makes it easier to start actions on the other apps.

The problem

I often read news (using Sunstroke, with a self-hosted instance of Fever) and emails on the iPhone, when I'm idle or waiting for something. Often I found interesting things that I'd like to explore further, or actionable emails. What I used to do for links was to copy the URL, go to MobileOrg, capture a note with some text and the link itself. I had no good way to deal with email messages, I just used to mark them unread, to be processed when back on a computer.

The solution (workflows)

Links

For interesting URLs I have prepared a simple python script which visits the page, extracts the title, and format a note in the same format used by MobileOrg (including a unique ID and a timestamp). After completing this, the script starts a custom action on Drafts, which appends the output to the MobileOrg.org file in my Dropbox. The python script is the following:

https://gist.github.com/taglia/2851907b3700770ec25d

I also have two custom actions on Drafts:

  • An action which runs the python scripts using the Pythonista URL scheme;
  • An action which appends the output of the previous action to the MobileOrg.org file in my Dropbox.

You should be able to import these actions by clicking on the links from an iOS device with Drafts installed. Note that the Pythonista action expects the script to be in a folder called "org".

Finally, if you want to start the workflow from Launch Center Pro, you can use a custom URL action with the following URL:

drafts://x-callback-url/create?text=&action=URL%20to%20Org%20Inbox

This assumes that your action in Draft is called "URL to Org Inbox".

Notes

It is easy to add notes to MobileOrg from the app itself, but it is so much more enjoyable to type on Drafts… I have slightly changed my python script, so it creates a note using the title and body of the text I have typed in Drafts itself. Here is the script:

https://gist.github.com/taglia/f627ea0dcfccdb334bee

Here is the Draft action that I use (again, for this to work the Pythonista script must be in a folder called "org").

Email messages

I have always found quite annoying not having the "message://" URLs on iOS. They are now available on iOS 7, still there is no easy way of creating them from Mail.app. I ended up trying several third-party email apps, and I finally I really like Dispatch; in Dispatch it is easy and fun to process several emails quickly, and the app can generate custom URLs which link back to email messages. The developers published a tool to make the custom URLs accessible on a Mac as well. Dispatch can send a message's URL to several productivity apps, or just copy it to the clipboard.

If you want Emacs to manage correctly Dispatch URLs, you need to add the custom link type. Adding the following lines to one of your startup files will do:

https://gist.github.com/taglia/3991e2ad69202108a6be

You may notice that I have not used Dispatch's custom URL, but I am using the standard "message:". This works (the message ID is unique), and it does not require you to install the helper required to open Dispatch's URLs.

This is still work in progress, as I need to modify slightly the python script (so it does not try to visit the URL to get the title).

Credits

Although the python scripts are original, many of the ideas here come from the work of Federico Viticci of MacStories. Have a look on his blog if you want a good idea of everything you can automate on iOS.

Next steps

I hacked these scripts and actions while on the subway, I know they are neither well designed nor well implemented! When I have more time I plan to clean everything up, create a proper bookmarklet to process a link directly from Safari or Chrome, and complete the workflow for emails. Now that I have tried it first hand, and seen how easy it is to automate stuff on iOS, I guess I will have many other ideas and use cases.

Let me know if there is interest for this and I will keep sharing.