Skip to content

Instantly share code, notes, and snippets.

@arthurlockman
Created September 8, 2020 19:58
Show Gist options
  • Save arthurlockman/fce336ec15ea4723afe92b210043a136 to your computer and use it in GitHub Desktop.
Save arthurlockman/fce336ec15ea4723afe92b210043a136 to your computer and use it in GitHub Desktop.
Notes to Evernote Migration (AppleScript)
tell application "Notes"
activate
set folderNames to name of folders
set chosenFolderNames to (choose from list folderNames with multiple selections allowed)
if (chosenFolderNames is false) then error number -128 -- Cancel button.
end tell
repeat with i from 1 to (count chosenFolderNames)
set thisFolderName to item i of chosenFolderNames
tell application "Notes" to set theNotes to notes of folder thisFolderName
set quotedFolderName to quoted form of thisFolderName
repeat with j from 1 to (count theNotes)
tell application "Notes"
set myTitle to the name of note j of folder thisFolderName
set myText to the body of note j of folder thisFolderName
set myCreateDate to the creation date of note j of folder thisFolderName
set myModDate to the modification date of note j of folder thisFolderName
end tell
try
tell application "Evernote"
set myNote to create note with text myTitle title myTitle notebook "Imported From Notes"
set the HTML content of myNote to myText
set the creation date of myNote to myCreateDate
set the modification date of myNote to myModDate
end tell
on error errMsg number errNum
display dialog "Note " & myTitle & " got an error: " & errMsg
end try
end repeat
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment