Updated: Post NetNewsWire Items to Evernote

February 17th, 2009  |  Published in ruby  |  5 Comments

Updated: Look at the comments. Ed points out that you don’t need FastScripts to add a Ruby script to the script menu. Use the Keyboard Shortcuts pref pane to tie it to a shortcut (which is much better than the old “name the script with underscores and pixie dust to get a shortcut” method.)

I started using Evernote in earnest over the past week. The big motivation to get started came from the benefits of clipping things at home and pulling them down from my iPhone while out of the house, which was something we needed to do a lot over the weekend.

Evernote’s first Mac iteration wasn’t very grand: No scripting support, no way to export notes. Those issues have been addressed, so what you’re left with is something very much like Yojimbo, only with a really good mobile client, network sync (that doesn’t involve MobileMe), multi-platform support and publicly shareable notebooks. (Here’s Evernote in a nutshell.)

The scripting syntax is as clean as anything, so it was pretty simple to adapt my NetNewsWire => InstaPaper script to save stuff from NNW to Evernote.

A quick recommendation on running Ruby appscripts in OS X: Red Sweater Software’s FastScripts, which provides an enhanced script menu that lets you run scripts written in something besides Applescript, and which allows you to assign keyboard shortcuts to those scripts. The InstaPaper and Evernote scripts I’ve got for NNW are tied to cmd-opt-i and cmd-opt-e respectively.


    #!/usr/bin/env ruby

    require 'rubygems'

    require 'appscript'

    require 'sanitize'

    include Appscript



    nnw = app("NetNewsWire")

    en = app("EverNote")



    item = nnw.selectedHeadline.get

    url = item.URL.get

    title = item.title.get



    description = Sanitize.clean(item.description.get)



    note = en.create_note(:title => title, :notebook => "Inbox", :with_text => description)



    note.source_URL.set(url)

    

Responses

  1. Ed Heil says:

    February 17th, 2009 at 9:30 am (#)

    If you use Library/Scripts/Applications (the global script menu, instead of Library/Application Support/NetNewsWire/Scripts/, you can use any scripting language even w/o FastScripts.

    Remind me sometime to show you the insanely special-purpose script I made by fusing your “post to instapaper” with a script I’d written previously to download images from http://goldenagecomicbookstories.blogspot.com/ for easy fullscreen slideshow viewing. :)

  2. mph says:

    February 17th, 2009 at 9:57 am (#)

    Hey … so you can! FastScripts has a few other conveniences, but that works for free and the Keyboard Shortcuts prefs pane works with it.

  3. Evernote Applescript Resources | Veritrope says:

    February 18th, 2009 at 11:43 am (#)

    […] NEW A Ruby/AppleScript solution to post NetNewsWire Items to Evernote […]

  4. Nick says:

    May 14th, 2009 at 11:07 pm (#)

    Wrong place for support, no doubt, but I couldn’t help asking you seeing as we are using the same tools. Are you running the Leopard standard install of ruby. When I execute ruby scripts through FastScripts the shebang appears to resolve to the standard Leopard ruby interpreter and not my updated MacPorts installation.

    Thanks Nick

  5. mph says:

    May 15th, 2009 at 10:10 am (#)

    Hey, Nick. Standard install, I’m afraid. So, #!/opt/local/bin/ruby or wherever MacPorts is doesn’t do the trick?

Leave a Response

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