TXT Based Diary with Alfred

January 25, 2012

I often have a lot of things that occur to me while I’m coding, or browsing the web, or listening to music – just any time I’m using my computer really. And I think “yeah, I’ll remember that”. I very rarely remember that.

A while ago I read on Brett Terpstra Logging with Day One Geek Style about logging thoughts with the Day One app (Brett’s blog is great – loads of poweruser tips and scripts all the time) and it may be that I buy Day One to do all this (I’m trying to be a little reserved, buying from the App Store has become too easy).

I’ve also been using Alfred App with the Powerpack for a while now – in an attempt to transition to power user.

So I thought I’d try and write a little Alfred script that appended my thoughts in a text file with a date. As it turns out there’s loads of Alfred scripts and tutorials scattered all over the ‘net. Texting & Tasking with Alfred gave me the basis of what I was looking for but I tweaked it a little.

Open Alfred and go to Extensions + ShellScript. Give your script a snazzy title like “Add to Diary”.

Fill in the blanks and choose a keyword to invoke your command (I chose “diary”).

The command is as follows:

echo "`date` - {query}" >> /Users/YOUR-USERNAME/PATH/`date +%m%y`.txt

Just change that line to reflect where you want to keep your new file. The `date` parameter will prepend your input text with the date and the final date parameter in the file path will create new text files based on the month number. (e.g. 0112.txt, 0212.txt). If you want to format the dates differently do a search on “shellscript date”.

Then click Advanced and un-tick all the escaping options apart from double quotes.


If you’re new to all this I’ve packaged the extension here Add to Diary.alfredextension.