Skip to content

Instantly share code, notes, and snippets.

@razbakov
Created January 30, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razbakov/b3efda54946f221d67d3e960540e92db to your computer and use it in GitHub Desktop.
Save razbakov/b3efda54946f221d67d3e960540e92db to your computer and use it in GitHub Desktop.
MigrateNotesToEvernote
-- Read more
-- https://dev.evernote.com/doc/articles/applescript.php
-- https://gist.github.com/evernotegists
-- https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/
-- https://www.macosxautomation.com/applescript/notes/05.html
-- https://macscripter.net/viewtopic.php?id=45602
tell application "Notes"
set theMessages to every note
repeat with appleNote in theMessages
set appleNoteTitle to the name of appleNote
set appleNoteBody to the body of appleNote
set appleNoteCreation to the creation date of appleNote
set appleNoteModification to the modification date of appleNote
set thisItem to appleNote
set appleNoteAccount to null
set appleNoteFolder to null
-- get folder and account of a note
repeat
set thisContainer to the container of thisItem
if (the class of thisContainer) is folder then
set appleNoteFolder to name of thisContainer
else if (the class of thisContainer) is account then
set appleNoteAccount to name of thisContainer
end if
if appleNoteFolder is not null and appleNoteAccount is not null then
exit repeat
else
set thisItem to thisContainer
end if
end repeat
tell application "Evernote"
set evernoteNote to create note with html appleNoteBody title appleNoteTitle notebook appleNoteFolder tags appleNoteAccount
set the creation date of evernoteNote to appleNoteCreation
set the modification date of evernoteNote to appleNoteModification
end tell
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment