thingsicon.jpegIf you’re a Things.app user (and a Terminal user), I’ve got a quick function for your .bash_profile that will allow you to quickly add todo items to your inbox with notes and natural-language date parsing.

It uses php’s strtotime function, which does a pretty swell job with simple dates like “next tuesday” or “+12 days”. It’s not very smart, though; you have to give it parameters in a specific order:

td "task name" "natural language date" "note"

Only the first parameter is required, so your task at least has a title. If you have two, it expects that the second is a date of some kind, and anything in the third will be added as a note.

Here’s the code…

function td() {
  if [ $# -lt 1 ]; then return 1;fi
  if [ $# -gt 1 ]; then
    duedate=`php -r "date_default_timezone_set('America/Chicago');echo date('m/d/y',strtotime('$2'));"`
    duedate=",due date:date \"$duedate\""
  fi
  osascript -e "tell application \"Things\"" \
  -e "make new to do at list \"Inbox\" with properties {name:\"$1\",notes:\"$3\"$duedate}" \
  -e "end tell"
}

Just paste it at the end of your ~/.bash_profile and type source ~/.bash_profile to read it in. If you use it, I’d love to hear about it, and if you improve it, let me know what you did differently!