Skip to content

Instantly share code, notes, and snippets.

@lwilli
Created February 4, 2018 18:17
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 lwilli/dbdc6b350bc1005e6d0852c538c6e767 to your computer and use it in GitHub Desktop.
Save lwilli/dbdc6b350bc1005e6d0852c538c6e767 to your computer and use it in GitHub Desktop.
Copies all folders and their notes from the Mac Notes app to Evernote
(*
Copies all folders and their notes from the Mac Notes app to Evernote.
How to run:
1. Download and setup Evernote on your Mac if you haven't already.
2. Open the Script Editor app on your Mac.
3. Copy and paste this script into the Script Editor.
4. Run the script (press the play button or via the menu Script>Run or ⌘R).
Considerations:
* Doesn't maintain multi-level folders (sub folders in Notes become their own root-level folders in Evernote).
* Doesn't copy attachments (see https://macscripter.net/viewtopic.php?id=45602 for a possible solution).
* Each new Evernote note is given the tag "imported_from_mac_notes"
Author: Logan Williams
Adapted from: d.b.walker's script (https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?do=findComment&comment=236445)
Date: 1 Feb 2018
Tested on: macOS Sierra (10.12.6)
*)
tell application "Notes"
launch
set notesFolders to every folder
repeat with noteFolder in notesFolders
if exists noteFolder then
log "Copying notes from " & name of noteFolder
set newNotebookName to name of noteFolder
-- Create new Evernote notebook for the folder --
tell application "Evernote"
launch
set newNotebook to create notebook newNotebookName
end tell
set notesInFolder to (notes of noteFolder)
-- Copy all notes from this folder to new Evernote notebook --
repeat with aNote in notesInFolder
set myTitle to the name of aNote
set myText to the body of aNote
set myCreateDate to the creation date of aNote
set myModDate to the modification date of aNote
tell application "Evernote"
set myNote to create note with text myTitle title myTitle notebook newNotebook tags ["imported_from_mac_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
end repeat
else
log "Looped past a non-existent folder..."
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment