Skip to content

Instantly share code, notes, and snippets.

@sudocode
Created October 11, 2015 07:37
Show Gist options
  • Save sudocode/ae26950f1dac9c2f6a81 to your computer and use it in GitHub Desktop.
Save sudocode/ae26950f1dac9c2f6a81 to your computer and use it in GitHub Desktop.
JXA script for exporting Evernotes to Apple Notes
/* Developed by Daniel Park (github.com/sudocode).
*
* Free for personal or commercial use, with or without modification.
* No warranty is expressed or implied.
*/
var App = Application.currentApplication(),
Evernote = Application('Evernote'),
Notes = Application('Notes')
// ask the user to select a Notes account to import Evernote data into
App.includeStandardAdditions = true
var notesAccount = App.chooseFromList(
Notes.accounts.name(),
{ withPrompt: 'Please select an account for importing your Evernote data into:' })
// quit if no choice made
if (!notesAccount) App.quit()
// otherwise proceed
notesAccount = Notes.accounts[notesAccount]
// go through each notebook from Evernote..
for (i in Evernote.notebooks) {
var notesFolder = null,
everNotebook = Evernote.notebooks[i]
// and use or create a Notes folder w/ the same name
if (notesAccount.folders.name().includes(everNotebook.name())) {
notesFolder = notesAccount.folders[everNotebook.name()]
} else {
notesFolder = Notes.Folder({ name: everNotebook.name() })
notesAccount.folders.push(notesFolder)
}
// then copy all notes from each notebook into the current Notes folder
for (var j in everNotebook.notes) {
var everChildNote = everNotebook.notes[j]
notesFolder.notes.push(Notes.Note({
name: everChildNote.title(),
body: everChildNote.htmlContent()
}))
}
}
App.displayAlert('All done!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment