Short version: 1) Have the desktop version of Evernote running on your Mac. 2) Open the built AppleScript app on your mac and copy and paste the code below into the editor and then click “run” (you can modify the code so the messages are organized in any folder in Evernote you wish.)
Note: At the end of this post is a modified version that looks for only notes in certain folders to move to Evernote.
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 tell application "Evernote" set myNote to create note with text myTitle title myTitle notebook "Imported Notes" tags ["imported_from_notes", "Mavericks", "Another_Example_Tag"] 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
Long version:
I take a lot of quick notes while on the go using the default notes app on my iPhone. I use it solely because it opens faster than any other notes app out there like Evernote or Asana. Speed is key with a notes application. (Sidenote: This is a good reminder for us all: If your product is incomplete in many ways but just so much faster and easier than other options, people will likely still use it.)
But after a couple months I have a few hundred notes and want to export them to review them. This is the part that is really annoying: Apple’s notes app doesn’t have a built in export feature. Yes, the iCloud syncing for notes between my phone and laptop and iPad works great but I want to export everything to a more fully-featured note storage app for tagging and more permanent storage.
I’m not the only person who wants to do something like this. A few people have created scripts that will export the notes to .txt or .html documents but they all get exported into separate files. Check out notes exporter if your want to export to separate text files. And also notes export if you want to export to separate HTML files. As mentioned, I want to export to either one document or one app like Asana or Evernote and preserve the timestamps on each note.
After a bunch of searching around and attempts at modifying different Apple Scripts to write my own, I found the best method is simply to import the notes to Evernote using the Apple Script code below. And I originally found this here.
You have to make sure your desktop app version of Evernote is updated. Mine was originally really old and it gave me a database error but it worked after updating! You can just update the Evernote tags you see in the script code to tags that make sense for you. And once you have the notes in Evernote you can do all sorts of stuff with them using Evernote’s API and superior exporting functionality — including exportation to other apps and services. You may also be able to just export directly to those apps as well by modifying the Apple Script. If you do, please leave a note in the comments to share your findings.
AppleScript is the old language first released in 1993 but it’s so powerful. Something simple like this makes my life a lot easier and it makes me wonder what other cool stuff you could automate more with AppleScript.
https://gist.github.com/77a8e20fbb62186ccfcc.git
Modified version that looks for notes in a specific Notes folder:
tell application "Notes" set myFolder to first folder whose name = "folder_name_here" set myNotes to notes of myFolder repeat with theNote in myNotes set myTitle to the name of theNote set myText to the body of theNote set myCreateDate to the creation date of theNote set myModDate to the modification date of theNote tell application "Evernote" set myNote to create note with text myTitle title myTitle notebook "Imported_Notes" tags ["tag_name_here"] 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