Skip to content

Instantly share code, notes, and snippets.

@brettgullan
Created August 12, 2016 00:56
Show Gist options
  • Select an option

  • Save brettgullan/880e1947af781bc144b78aacb7f9edc3 to your computer and use it in GitHub Desktop.

Select an option

Save brettgullan/880e1947af781bc144b78aacb7f9edc3 to your computer and use it in GitHub Desktop.
Append a time-stamped text string to a Daily Log entry in Evernote.
(*
Appends an entry to today’s Daily Record of Events in Evernote.
For best results, invoke the script from LaunchBar.
c.f. https://gist.github.com/csreed/666ceee01617800164fddebb0bdde872#file-new-planner-entry-scpt
*)
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 time stamp to start of entry
-- add a blank line between entries
set newHTML to time string of (current date) & ": " & str & "<br />"
-- Set this string to the Evernote notebook title
set theNoteBook to notebook "@daily"
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
else
set theNote to first item of todayNotes
tell theNote
append html newHTML
end tell
end if
end tell
end handle_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment