How to Append to Evernote Notes with AppleScript

Recording your day should be this easy.

by Colter Reed
2:07 read (647 words)
by Colter Reed
2:07 read (647 words)

Whether your planning system is digital or paper-based, it needs to let you capture ideas and information quickly. The more time and energy it takes to change gears, capture what you need to, and get back to what you were going, the more you’re going to lose your stride, and the longer it’s going to take you to recover.

This is why I love OmniFocus’s quick entry panel. As soon as the “I need to…” thought enters my mind, I’m just a keystroke away from recording it in OmniFocus’s Inbox. I can capture calendar events with Fantastical or Siri almost as easily.

Setting up capture for my daily record of events wasn’t as easy. I use Evernote to keep a record of what I do, and I couldn’t find a turnkey solution for capturing notes that I like. Evernote’s menu bar app lets you create a new note easily, but I want to create a note with a very specific title and in a certain notebook, or append to today’s note if it already exists.

It was nothing a little AppleScript couldn’t fix.


To use the script, you’ll need a notebook in Evernote called Planner. I highly recommend creating a dedicated notebook if you’re going to use Evernote as part of your planning system. Goals, project support notes, daily records, and bills can all go in here.

(If you already have Evernote set up the way you like it, just tweak the script to fit your system.)

The simplest way to run the script is to assign the script to a keystroke using Keyboard Maestro. I have it assigned to F18, with some other planner macros. This way, adding a new entry to the daily record of events involves two steps:

  1. Press F18 to bring up the dialog box.
  2. Type the planner entry and press return.

The script also has a text input handler for LaunchBar, one of the first apps I install when I set up a new computer. I place all my scripts like this in ~/Library/Scripts and have LaunchBar index that folder.

  1. Press ⌘-space to bring up LaunchBar.
  2. Type npe for “New Planner Entry…”.
  3. Press space to start typing text.
  4. Type the planner entry and press return.

Evernote will launch if it isn’t already running. The script will check your Planner notebook for a note titled “Daily Record YYYY-mm-dd”, create a new note if it doesn’t find one, and add your new entry to it.


(*
Appends an entry to today’s Daily Record of Events in Evernote.
For best results, invoke the script from Keyboard Maestro or LaunchBar.
*)
property notebookName : "Planner"
property noteTags : {"daily record"}
on run — Called when the script is run normally
set theTitle to "Daily Record of Events for " & (do shell script "date '+%A, %B %e'")
display dialog "What did you do to reach your goals?" default answer "" with title theTitle
handle_string(the result's text returned)
end run
on handle_string(str) — Called directly when invoked from LaunchBar
tell application "Evernote"
— add a blank line between entries
set newHTML to str & "<br />"
set theNoteBook to notebook notebookName
set noteTitle to "Daily Record " & (do shell script "date '+%Y-%m-%d'")
set todayNotes to every note of theNoteBook whose title is noteTitle
if length of todayNotes is 0 then
create note with html newHTML title noteTitle notebook theNoteBook tags noteTags
else
set theNote to first item of todayNotes
tell theNote
append html newHTML
end tell
end if
end tell
end handle_string

If you want to develop a new habit, make it as easy as possible to do it. Using this script from LaunchBar or Keyboard Maestro, there’s less than a second of overhead to start capturing into today’s record of events in Evernote.

Keeping a record of what you do every day has many benefits. If you use Evernote, this script will help you record what you’ve done quickly and easily, so you can see the growth.

Question: What other notes would you want to be able to append to quickly? Share your thoughts in the comments, on Twitter, LinkedIn, or Facebook.