Getting OmniFocus and nvALT To Play Nice

Geeky Quick Tips is a series of simple, code-free tips and tactics for doing more with your Mac or iOS device. For more detailed geekery, be sure to checkout the Techie Scheky series.

A while back I shared the way that I use OmniFocus to create tasks with links to a specific email, file or website. Shortly after, I followed up with a way to use Keyboard Maestro to overcome a shortcoming of the Quick Clipper in OmniFocus in order to create tasks with links to specific “notes” in Evernote.

Lately I find myself creating far more tasks from files in nvALT and have wanted a similar solution. Once again, Keyboard Maestro came to the rescue and made it possible to replicate the functionality of the OmniFocus Quick Clipper. Just add the following macro to your Keyboard Maestro library (preferably in a folder that only works with nvALT) and you will be good to go.

The macro will copy any text you have selected, and copy the URL that will bring you back to the file in nvALT. It will then open the Quick Entry box for OmniFocus, paste your link as well as any text you’ve selected into the notes field, and return you right back to the first entry field. If you don’t have any text selected, it will only copy and paste the link. The result looks just like this:

OmniFocus QuickEntry

Thanks to Gabe Weatherhead at Macdrifter who, once again, had to reminded me how to handle selected text in Keyboard Maestro.

If you’ve been looking for a better way to create OmniFocus tasks from nvALT, click here to download the macro.

Update: I incorrectly posted a version of the Macro that copied the Notational Velocity link and not the nvALT link. This has been corrected. I’m also having a bit of trouble getting the link to open on my end when clicking it, but LaunchBar seems to be doing the job just fine. For those who prefer clickable links, Gabe over at Macdrifter has you covered.

Update 2: While it’s not as elegant as I’d like, I finally got the macro to function exactly as I wanted. You can download the new version of the macro here. All download links have been changed to reflect this revised version.

Be sure to subscribe for free by Email or RSS to automatically receive future Geeky Quick Tips as well at other geekery from A Better Mess.

  • Jos v.d. Voort v.d. Kleij

    I see the nvalt link in the quick entry box shows “nv”. Up until now I have always had to edit this into “nvalt” to make the links work. Updating nvalt to the latest beta did not change that behaviour. Do you have any solution for this?

  • Ken Case

    OmniFocus is careful about what URL schemes it will automatically create from text input, but you can link to anything you want if you use AppleScript:

    -- These are the parameters you might want to tweak

    set TaskName to "Task name goes here"

    set TaskNote to "Plain text note goes here"

    set TaskLinkName to "Open in Notational Velocity"

    set TaskLinkURL to "nvalt:whatever"

    -- Here is the script code itself

    tell application "OmniFocus"

    tell quick entry

    -- open the quick entry window


    -- Create a new inbox item

    set NewInboxItem to (make new inbox task with properties {name:TaskName, note:TaskNote})

    -- Add a link to the top of the note

    tell note of NewInboxItem

    insert TaskLinkName & return & return at before first character
    set value of attribute "link" of style of paragraph 1 to TaskLinkURL

    end tell

    -- Expand the note so it's visible in the Quick Entry window

    set note expanded of last leaf to true

    end tell

    end tell

    Hope this helps!

    • MSchechter

      Thanks Ken! This should prove very helpful when creating clipper-like functionality for other apps. Now I just have to see how to reconcile the nv links with the proper nvalt links. Should be fun :)

    • Ken Case

      If you want to start automatically editing the task name after creating it, you can insert this code right after the bit that expands the note:

              -- Start editing the task name
              select last leaf -- Select the new item
              activate -- Make the app active so it gets our scripted keystrokes
              delay 0.25 -- Give it a chance to activate
              tell application "System Events"
                  if UI elements enabled is true then
                      tell process "OmniFocus"
                          keystroke "e" -- Starts editing the current row
                          keystroke "a" using command down -- Command-A selects the text
                      end tell
                  end if
              end tell

      • MSchechter

        Thanks Ken :) Keyboard Maestro was able to overcome many of my shortcomings, but this should make it a bit more self-contained! Really appreciate all of the help.

  • Simon Tännler

    Hey Mike, do you mind posting a screenshot of your Keyboard Maestro macro? I might be able to reengineer the same behaviour in plain AppleScript since I have not bought into Keyboard Maestro…yet :).

  • Ronn Reeger

    Just getting around to getting this set up on my end. Pretty slick though. Thanks for sharing!

  • amelchi

    sorry to get late on the wagon… but the quick clipper works inside any text app, in Scrivener btw?

    thanks for help


    • MSchechter

      It will work, but only some apps will only copy text. Others can occasionally add a link. Scrivener includes text only.