#!/usr/local/bin/ruby # # Created by Brett Terpstra on 2007-06-29. # Copyright (c) 2007. All rights reserved. # requires sqlite3-ruby, which can be installed via rubygems # > sudo gem install sqlite3-ruby # # If you want to use growl uncomment the escape require and the growlnotify lines, # and coment out the print output lines. You'll need to install the escape gem: # > sudo gem install escape # Then you can run the script directly from quicksilver without an applescript trigger. require 'rubygems' require 'sqlite3' #require 'escape' dbToUse = "#{ENV['HOME']}/Library/Application Support/iGTD/iGTD.sql" db = SQLite3::Database.new( dbToUse ) rows = db.execute( "SELECT task.ZNAME,project.ZNAME FROM ZTASK AS task, ZPROJECT as project WHERE task.ZPARENTPROJECT = project.Z_PK AND task.ZNEXTACTION = '1' AND task.ZMAYBE = '0' AND task.ZCLEANEDUP = '0' AND task.ZWAITINGFOR = '0' AND task.ZPRIORITY = '1'" ) output = "" count = 1 rows.each do |task,project| output += "#{count}. #{task}\r [#{project}]\r" if count == 5 # %x(/usr/local/bin/growlnotify -m #{Escape.shell_command(output)} -t "Top 5 Next Actions" -s -a "iGTD") print output exit end count += 1 end #{}%x(/usr/local/bin/growlnotify -m #{Escape.shell_command(output)} -t "Top 5 Next Actions" -s -a "iGTD") print output