Skip to content

Instantly share code, notes, and snippets.

@derickfay
Last active August 8, 2017 19:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save derickfay/4838fb9792a627bf2954 to your computer and use it in GitHub Desktop.
Save derickfay/4838fb9792a627bf2954 to your computer and use it in GitHub Desktop.
set theDate to do shell script "date '+%Y-%m-%d'"
set outputPath to "~/Dropbox/mytemp/"
set format to "txt"
set counter to 1
set theFolder to "Notes"
-- uses a counter to avoid duplicate filenames if notes have the same title
tell application "Notes"
tell folder theFolder
set theNotes to every note
repeat with n in theNotes
set t to body of n
do shell script "echo " & quoted form of t & "| textutil -format html -convert " & format & " -stdin -output " & outputPath & "/" & quoted form of ((name of n) as string) & "_" & counter & "_" & theDate & "." & format
set counter to counter + 1
end repeat
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment