December 16, 2013

Launchbar to Taskpaper

I noticed that the script for sending tasks from mutt to taskpaper could be tweaked to send tasks from Launchbar to Taskpaper, so I set about doing just that. (There is a Service that comes with Launchbar for sending items to the Taskpaper Inbox, but I wasn’t satisfied with it.) Here’s the script:

# Important disclaimer: I have no idea what I’m doing

TEMPTODO=$(basename "$0")
TMPFILE=$(mktemp /tmp/"${TEMPTODO}".XXXXXX) || exit 1
printf "$1" | sed 's/^/    - /' | unexpand -t4 > "$TMPFILE" || exit 1

The shell script worked when called directly from Launchbar, but I couldn’t get the string to escape properly and ended up putting the todo item in “”; not ideal. A little digging revealed that Launchbar has a built-in method to send a properly escaped string to a shell script, using Launchbar’s Search Template feature. You just open the Index in Launchbar, select Search Templates and add a new template, give it a name (I’ve used ttt) and add:


as the search item. You can now call Launchbar from whatever application you’re in and add a task to your Taskpaper Inbox. You can also train Launchbar to launch the search query from a single letter, like T. It should be noted that you will need to change the path in the script to match your setup, and the script assumes that the first line of your Taskpaper file is Inbox:.

setting up launchbar to taskpaper shell script