Computing: July 2008 Archives

OmniFocus Hack - the mobile list

| | Comments (0)

For those of you who use OmniFocus and won't be getting an iphone, this one could really come in handy. It's a ruby script that talks to OmniFocus via OSA, grabs all the items in a given context, then writes them as poorly-formed html over ssh to a predefined destination. Cheap and dirty, but it's the quickest way I've found to get stuff like this available anywhere, especially in a mobile phone browser.

#!/usr/bin/ruby

require 'rubygems'

require 'rbosa'

require 'net/ssh'

of = OSA.app 'OmniFocus'

shopping_list = of.default_document.contexts.collect { |x| x if x.name == 'Errands' }.compact.first.contexts.collect { |x| x if x.name == 'Shopping' }.compact.first

items = shopping_list.tasks.collect { |x| x.name unless x.completed? }.compact

def post_file( shell, file, datum )

shell.touch(file)

shell.send_command("echo \"#{datum}\" > #{file}")

end

def build_html(items)

"<ul>#{items.collect{|item| '<li>' + item + '</li>' }}</ul>"

end

Net::SSH.start( 'myserver.dreamhost.com' ) do |session|

shell = session.shell.sync

post_file shell, "~/shoppinglist.mydomain.com/index.html", build_html(items)

shell.exit

# session.loop

end


About this Archive

This page is a archive of entries in the Computing category from July 2008.

Computing: April 2008 is the previous archive.

Computing: November 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

November 2008: Monthly Archives

Pages

Powered by Movable Type 4.1