applescript

OmniFocus2Evernote

I like keeping track of tasks in OmniFocus (for now) and I like to keep notes in Evernote (most of the time). I don’t like keeping notes in OmniFocus outside of a few quick jots to add context to a task.

This afternoon I was setting up a series of tasks that will require some research, links to assorted pages, links to notes within Evernote, and some other stuff that further busted my willingness to keep notes in OmniFocus, so I came up with this script.

What It Does

It takes your currently selected OmniFocus task or project (henceforth referred to as “the item”) and makes a new note in Evernote with it. That note has a few characteristics that are useful:

First, the source URL of the new Evernote note is the application URL link of the item. It looks like this in Evernote:

Evernote Premium

That means if you’re in the Evernote note and need to find your way back to the OmniFocus item, you can just click that link and away you go. You can find that link in Evernote for mobile by tapping the note’s info button.

Second, it sets an Evernote reminder that matches the due date of the item. If you use reminders (doesn’t everybody?) then you will have a tidy list of notes that are associated with (and linked to) your OmniFocus items readily available.

Third, it prepends the new Evernote note’s link to the OmniFocus item’s note, so that when you’re in OmniFocus, you can easily find your way back to the Evernote note.

Making It Easier to Use

OmniFocus will let you save scripts in its script folder then set them up as buttons in its toolbar:

  1. Make sure you have the directory ~/Library/Application\ Scripts/com.omnigroup.OmniFocus2
  2. Save the script below into that directory.
  3. Open OmniFocus
  4. Right-click on the toolbar and select “Customize Toolbar …”
  5. Look for a black-and-white script icon with the name of your script.
  6. Drag that icon into the toolbar.

You can make sure it’s working by selecting a task or project and clicking the icon. In this case, “working” means:

  • A new note in Evernote is created with:
    • a title matching that of the OmniFocus item
    • a link back to the OmniFocus item
    • a reminder set to the due date of the OmniFocus item
  • A link to the Evernote note is appended to the top of the OmniFocus item’s note.

Bugs:

  • It’ll bomb if you try to do this with an OmniFocus context.
  • It is stupid and doesn’t care if you’ve already done this with the existing project or task: You’ll just get more links added to the item’s note, and more Evernote notes will be created.

In Which I Write Some AppleScript to Save the Big Magical Gnu

Meditate

People at the Friday all-hands made fun of Emacs. I briefly imagined a big, magical gnu sadly, slowly fading away because nobody believed in it anymore, and then I thought of all the ways I’ve failed to support that big, magical gnu. So in a fit of emacsimalism I wrote some AppleScript to convert all my Things projects to org-mode projects, and their tasks to org-mode todos.

It understands:

  • Tags, and converts them to org-mode-style, colon-delimited lists.
  • Due dates, and converts them to deadlines.
  • Status:
    • “open” converts to “TODO”
    • “completed” converts to “DONE”
    • “canceled” converts to “CANCELED,” which you’ll need to add to your org-mode configuration with something like this:
      (setq org-todo-keywords '((sequence "TODO" "|" "DONE" "CANCELED")))

I stopped short of:

  • Mapping “Areas” to something (like org-mode properties, I guess)
  • Mapping “Contacts” to something (I always use the “@name” convention to tag people)
  • Making it put its output somewhere. It just returns a big string you can copy out of Script Editor’s output field and paste into a text file.
  • Bothering with the idiocy needed to get AppleScript to pad any single-digit elements of a date with zeroes. I just hand off to a Ruby one-liner with do shell script.

Cheer up, magical gnu!

Send the Current iTunes Net Radio Track to Evernote

I like to listen to ‘net radio stations like SomaFM and KCRW’s Eclectic 24. Sometimes I hear new stuff and don’t want to take the time to make a note of it. This little script captures current ‘net radio track info from iTunes and sticks it in an Evernote note with an embedded source URL of the current stream:

I used to have an rb-appscript that did this with Things. Here’s that in case you feel like fiddling with stuff living on borrowed time:

As with just about every little one-off script I write, I use FastScripts to hook it up to a keyboard shortcut. Pretty sure there are better (free) ways, but I’ve had a FastScripts license for years. I think you can get the same effect creating an inputless service with Automator that just runs the Applescript, then assigning a keyboard shortcut to it.

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.