Bill Brown bio photo

Bill Brown

A complicated man.

Twitter Github

I read about the virtues of logging what you do all day long ago, but a recent article re-kindled my interest. (Sadly, I can't locate that blog entry and it was a very good one.)

On Quicksilver, it was rather easy to accomplish a digital work journal. But I don't use Quicksilver any longer—I've converted wholly to Alfred. It's almost as perfect as Quicksilver; I miss the large-type view and some of the gratuitous animations, but it has the benefit of being usable.

My first order of business was to figure out how to append a message containing an automatically generated timestamp to the end of a text file. This was surprisingly harder than I thought. There really wasn't any decent shell scripts I could find via Google and the searches yielded a lot of ways to time stamp a log file.

Here's what I ended up cobbling together:

#!/bin/bash
echo "$(date +%Y-%m-%d/%T): $@" >> ~/Dropbox/PlainText/Work/Work\ Log.txt

This produces a line like "2011-05-30/13:13:00: Testing script" when you enter "./work.sh Testing script" on a Terminal prompt. That's exactly what I want to log and putting it in that location syncs it automatically with Dropbox and makes it available to PlainText on the iPad and iPhone.

Now I just needed to make it easy to use from Alfred. I originally created a bash alias called "work" so I could just type "> work Test script" into Alfred. Then I discovered a helpful tip about a new Alfred feature: Terminal Shortcuts.

Settings for Alfred integration

It works like a charm!

[UPDATE (5/31/2011): This isn't the article I read, but it's good nonetheless.]