Logging Blog Ideas

July 12, 2012 •

Like most people these days, I’d like to blog more. A key part of that is finding things to write about. Whenever I had an idea, I would open up nvALT, find my list of ideas, then add a new idea to the bottom. None of those steps are too difficult, but they do cause a fairly lengthy disruption if you are in the middle of something else. To streamline the process, I used Alfred, an application launcher from Running With Crayons.

One great feature of Alfred is the ability to trigger a shell script, along with passing it an optional parameter. A simple shell script to log ideas would look something like this:

	echo "idea" >> ~/Dropbox/notes/blog_ideas.txt

Combining that with Alfred means that I can replace whatever is inside the quotes with a parameter that Alfred will pass to the script. The value this parameter takes will be whatever you type after the keyword you use to trigger your script. The actual script you need to put in Alfred looks something like this:

echo "- {query}" >> /Users/david/Dropbox/notes/blog_ideas.md 
    && echo "Added {query} to blog ideas…"

I use a hyphen at the start of the item because I maintain my file as a markdown list. The echo at the end gives me a Growl notification with whatever was added to my list of ideas. I can now hit ⌘-Space to bring up Alfred, then type “blog ‘new idea’“, and get a new line at the end of my ideas file.