Hiveminder To Do List via Quicksilver
Michael Buffington’s iGTD + Quicksilver + subversion tutorial clued me in to the fact that Ruby/Perl/Python/etc. scripts placed in a user’s ~/Library/Application Support/Quicksilver/Actions/ are usable by Quicksilver as actions. This made me want to try it out with my To Do manager of choice, Hiveminder. I mostly use Hiveminder’s web interface, but the Hivemider folks put together a “todo.pl” command line interface as well. I needed to make one change to this todo.pl to get it working as a Quicksilver action. In the interest of helping out, I am making a record of it here.
Using todo.pl from the command line, task entry looks like this:
$ todo.pl add buy grapefruit [errands]
This adds the task “buy grapefruit” to my To Do list with the tag “errands”.
After putting todo.pl into ~/Library/Application Support/QuickSilver/Actions/, I attempted to use it via Quicksilver to enter a task. I invoked Quicksilver (ctrl-space), entered text mode (“.”), and entered the following text:
add buy grapefruit [errands]
Then, I hit tab and typed “todo” as the action, and hit return. This launched todo.pl. Unfortunately, the task was not added to my To Do list and I saw no feedback from Quicksilver. I poked around a bit and found that Quicksilver conveniently puts the output from such actions into console.log. Mine said
Unknown command: add buy grapefruit [errands]
followed by a long usage statement about the args todo.pl expects. This was not very helpful, since “add” should be a valid command. Adding some more explicit warn() statements to todo.pl revealed that Quicksilver passes the entire command string to todo.pl as the first argument. (While ‘add’ is a valid commend to todo.pl, ‘add buy grapefruit [errands]’ is not.) In Perl terms, that means todo.pl sees an @ARGV containing one item
(‘add buy grapefruit [errands]’)
instead of multiple items
(‘add’, ‘buy’, ‘grapefruit’, ‘[errands]’)
The fix is quick, though. Simply adding the following to todo.pl before any @ARGV processing occurs will fix the problem:
@ARGV = split /\s/, $ARGV[0];
This statement takes the first argument to the script ($ARGV[0]), splits it on whitespace into a list of strings, and then replaces @ARGV with that list. The first element in @ARGV is now “add” and todo.pl proceeds normally.
Now I see the satisfying text “Created task” in Quicksilver after entering a task.