Things: Add NetNewsWire Headline

An inbox with an attractive tick on it (like the symbol for a tick, not a little beastie that latches on to your leg and gives you Legionnaire's Disease or something)While hacking my way through the RSS jungle in NetNewsWire, I often find something interesting that I don’t have time to look at right now. Instapaper takes care of long form articles, but if the media in question is a little richer – a video of a skateboarding dog, say – you’ll need another way to come back to it.

This script (which is based on this one by Mike Hall) creates a new To Do in Things based on the currently selected headline, gives it a couple of tags to make it easy to find again, and embeds the URL in the notes section. So you can save up all your Internetistractions (and yes, that is a clumsy neologism/portmanteau of my own creation) and consume them when you’re not supposed to be working.

Download Add to Things.rb.zip

The source code is hastily finishing its breakfast and pulling on its gumboots, just south of here.

#!/usr/bin/env ruby
# coding: utf-8

# Ian Haigh - thejoyofappscript.com

# Make a new To Do in Things, based on the name and URL of the currently
# selected item in NetNewsWire. The new To Do goes slap bang into the "Someday"
# category. Handy for temporary bookmarks for things that you want to check
# out later but aren't suitable for Instapaper, like video.

# Based on this script by Mike Hall:
# http://mph.puddingbowl.org/2010/07/creating-links-in-the-body-of-a-note-in-things/

TAGS = "nnw, watch"
# tags that get added to the new To Do

def create_to_do(name, source, link)
	if link == ""
		note = name
	else
		note = "[url=#{link}]#{name} - #{source}[/url]"
	end

	task = @things.make(:at => app.lists["Someday"].beginning, :new => :to_do, :with_properties => {
		:name => "#{source} – #{name}",
		:tag_names => TAGS,
		:notes => note,
	})
end

require 'rubygems'
require 'appscript'
include Appscript

nnw = app("NetNewsWire")
@things = app("Things")

name = nnw.selectedHeadline.title.get
link = nnw.selectedHeadline.URL.get
source = nnw.selectedHeadline.subscription.givenName.get

create_to_do(name, source, link)

#`growlnotify -p 1 -m "Added \"#{name}\" to things."`

# uncomment the previous line if you've got Growl installed
# and you want a pretty message to pop up.
This entry was posted in things. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • What’s this all about then?

    rb-appscript is a powerful way to automate your Mac. It's similar to Applescript but it's built in Ruby, which means you get to leverage that language's powerful syntax and libraries. Giving you more time to make toasted sandwiches. You want long-winded explanations? We got those.

    Please note that these scripts are by no means bulletproof, and are intended to provide examples of application scripting. I take no resposibility for any loss of data or mishaps; you download and run everything at your own risk. That said, I use all of these scripts in a production environment every day (well – more accurately, I use some of these scripts in a production environment most days).