If you read A solution for scatterbrains yesterday, but were left feeling like the solution just wasn’t geeky enough… here’s a Saturday morning post to help you out. You do actually need to read that for this to make any sense. Here, I’ll link it again for you.

Geek it up

To make this a little geekier: if you’re doing this in nvALT, you can right click the note in the list to copy a URL. Then create a wwid (what was I doing) alias in your .bash_profile:

alias wwid='open nvalt://find/YourNoteURL'

Now you can access that note directly in nvALT from the Terminal with wwid. You can also put that bookmark on a hotkey using any of the various keyboard shortcut apps. Alternatively, if you’re using a plain text file without nvALT, just create an alias or AppleScript to open it in your favorite editor…

No, seriously. Geek it up.

Given my love for the command line, it’s unsurprising that I wrote a little script to work with this system. You can, of course, get the full contents of the note with QuickQuestion (qq doing). Because I added a “later” section and wanted to clean up the output, I created a second method. My input file (?? What was I doing.md) looks like this:

	- 2011-11-03 20:22 | something entirely different
	- 2011-11-03 20:19 | something I've been working on for a while now
	- stuff I intend to come back to and am not ready to delete yet
	- this part of the file is ignored by the `doing` script

You can leave that line blank or add your own tag, but there needs to be a line before the “Currently” project starts (the script inserts all new entries at the third line, so it would get weird if that wasn’t the first line of the section, right?). The script also expects the entries to be tabbed in and the project headings to be flush left. The Later section can have any name, or not be there at all. It’s ignored by this script.

Here’s the script1 with no comments and no explanation2:

DOINGFILE="/Users/ttscoff/Dropbox/Notes/nvALT2.1/?? What was I doing.md"

if [[ $# -eq 0 ]]; then
  awk '{\
  if (currently==1)
    if (match($0,/^[^\t]/))
    else {
      if ($0 !~ /@done/) {
        sub(/^[ \t]+/,"")
    if (match($0,"Currently:"))
  head=`awk 'NR < 3' "$DOINGFILE"`
  tail=`awk 'NR > 2' "$DOINGFILE"`
  datestamp=`date +'%Y-%m-%d %H:%M'`
  echo -e "$head\n\t- $datestamp | $input\n$tail" > "$DOINGFILE"

Just paste this into a file and save it in your path as “doing”. Set the DOINGFILE variable to the path to your note. Lastly, run chmod a+x /path/to/doing to make it executable.

If you run the script with no arguments, it will spit out the “Currently:” section of the file (requires that there be a “Currently:” section of the file). I’d get this from the input file above:

$ doing
- 2011-11-03 20:22 | something entirely different
- 2011-11-03 20:19 | something I've been working on for a while now

If you run it with an argument, it takes it as a new entry, adds a timestamp and inserts it at the top of the Currently section.

$ doing "something I've always wanted to do"
$ doing
- 2011-11-03 20:35 | Something I've always wanted to do
- 2011-11-03 20:22 | something entirely different
- 2011-11-03 20:19 | something I've been working on for a while now

You have to manually edit the file to remove old entries or mark things completed, but the script is a handy means of input. You can interface it with LaunchBar fairly easily, too, if that fits your workflow better. Once you’ve set up the doing script, just create an AppleScript at ~/Library/Application Support/LaunchBar/Actions/Doing.scpt and paste this into it:

-- Right click and Copy URL in NV or nvALT to get this
property notelink : "nv://find/%3F%3F%20What%20was%20I%20doing/?NV=Hd9WpOVTTtuY3Zu6gljYVA%3D%3D"

on handle_string(message)
  -- get the input from LaunchBar
  if message is "?" then
    -- if the input is just "?" display the script response
    set _doing to do shell script "/Users/ttscoff/scripts/doing"
    tell application "LaunchBar" to display in large type _doing
  else if message is "e" or message is "edit" then
    -- if the input is just "e" or "edit", open the nvALT note link
    -- if you're not using nvALT, replace this with a command to open 
    -- your note in your preferred editor
    open location notelink
    -- otherwise, create a new entry using the input
    do shell script "/Users/ttscoff/scripts/doing \"" & message & "\""
  end if
end handle_string

In LaunchBar, type ‘doing’ to select the action and hit the spacebar. Type in your entry and hit return. The timestamp will be added by the script, and the netry will be inserted at the third line of your file. If, in the LaunchBar’s text field, you type just a question mark (?), you’ll get a heads-up display of your current entries. Typing just “e” or “edit” will open the link you set up at the top of the script.

There you go. Now you know what I think is keeping me sane and are simultaneously questioning my sanity.

  1. Yeah, I should have just done it in Ruby (or Perl), but I started out trying to make a Bash one-liner and things just got out of hand. 

  2. man awk. Do it.