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)

Pingback: Evernote Applescript Resources | Veritrope