Hey everyone,
I couldn't get the script here to work, so decided to write a new one.
I followed this very useful tutorial here to get started https://macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html
The difference is, my script will let you choose which folder in Notes that you want to export (you can multi select) then it will create it as a Notebook in Evernote.
This works on macOS Catalina 10.15.6.
Follow the steps in the link above but use this code instead. Enjoy
// set things up
var app = Application.currentApplication();
app.includeStandardAdditions = true;
var notesApp = Application('Notes');
notesApp.includeStandardAdditions = true;
var enApp = Application('Evernote');
enApp.includeStandardAdditions = true;
// choose which notes
//var notes = notesApp.folders;
var folders = notesApp.accounts.byName('iCloud').folders;
var whichFolders = app.chooseFromList(folders.name(), { withPrompt: "Which Folders?", multipleSelectionsAllowed: true });
if (whichFolders) {
// loop through all folders
for(var i=0; i<folders.length; i++) {
// is this folder one to be exported?
if (whichFolders.indexOf(folders[i].name()) > -1) {
var foldername = folders[i].name();
var notebook = enApp.createNotebook(foldername);
// get notes in the folder
var notes = folders[i].notes;
for(var j=0; j<notes.length; j++) {
var name = notes[j].name();
var html = notes[j].body();
var creationDate = notes[j].creationDate();
var modificationDate = notes[j].modificationDate();
var enNote = enApp.createNote({ title: name, withHtml:html, created: creationDate, notebook: notebook});
enNote.modificationDate = modificationDate;
}
}
}
}