I've made a minor adjustment to this code, it preserves folders and account by making a new notebook for each folder (within an account) and tags the account the note is associated with. This can be easily switched if you prefer your notebooks to be based on accounts and tagged with the folders.
tell application "Notes"
set theMessages to every note
repeat with thisMessage in theMessages
set myTitle to the name of thisMessage
set myText to the body of thisMessage
set myCreateDate to the creation date of thisMessage
set myModDate to the modification date of thisMessage
set thisItem to thisMessage
set myAccount to null
set myFolder to null
repeat
set thisContainer to the container of thisItem
if (the class of thisContainer) is folder then
set myFolder to name of thisContainer
else if (the class of thisContainer) is account then
set myAccount to name of thisContainer
end if
if myFolder is not null and myAccount is not null then
exit repeat
else
set thisItem to thisContainer
end if
end repeat
tell application "Evernote"
set myNote to create note with text myTitle title myTitle notebook myFolder tags myAccount
set the HTML content of myNote to myText
set the creation date of myNote to myCreateDate
set the modification date of myNote to myCreateDate
end tell
end repeat
end tell
if you want to make the notebook names from accounts and the tags from folders (opposite of what I have), you would change "set myNote to create notewith textmyTitletitlemyTitlenotebookmyFoldertagsmyAccount" to "set myNote to create notewith textmyTitletitlemyTitlenotebookmyAccounttagsmyFolder".
It's the end of 2018 and this code still works to transfer Notes into Evernote. It ends with an error but a hand-audit revealed all notes made it into Evernote. This solution should be elevated within Evernote Support documents. Took a *ton* of time searching Google before tripping across this. If you need to export Apple Notes into Evernote... this is by far the fastest & easiest way to do it.
Importing from Apple Mail.app's Notes
in Evernote for Mac Issues (Versions 7.14 and under)
Posted
It's the end of 2018 and this code still works to transfer Notes into Evernote. It ends with an error but a hand-audit revealed all notes made it into Evernote. This solution should be elevated within Evernote Support documents. Took a *ton* of time searching Google before tripping across this. If you need to export Apple Notes into Evernote... this is by far the fastest & easiest way to do it.