Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sowenjub/5138539 to your computer and use it in GitHub Desktop.
Save sowenjub/5138539 to your computer and use it in GitHub Desktop.
Updated to import the modification date as well since that's how notes are sorted in Note.app
tell application "Notes"
set theNotes to every note of the folder "Notes"
repeat with thisNote in theNotes
set myTitle to the name of thisNote
set myText to the body of thisNote
set myCreateDate to the creation date of thisNote
set myUpdateDate to the modification date of thisNote
tell application "Evernote"
set theTransferredNote to create note with html myText ¬
title myTitle ¬
created myCreateDate ¬
notebook "Imported Notes"
set modification date of theTransferredNote to myUpdateDate
end tell
end repeat
end tell
@billda
Copy link

billda commented Jun 17, 2013

Here's a small improvement since Evernote crashes (and stops the import) if there is a title longer than 255 characters:

tell application "Notes"
set theNotes to every note of the folder "Notes"
repeat with thisNote in theNotes
set myTitle to the name of thisNote
if length of myTitle is less than 255 then
set myShortTitle to myTitle
else
set myShortTitle to text 1 thru 254 of myTitle
end if
set myText to the body of thisNote
set myCreateDate to the creation date of thisNote
set myUpdateDate to the modification date of thisNote
tell application "Evernote"
set theTransferredNote to create note with html myText ¬
title myShortTitle ¬
created myCreateDate ¬
notebook "Notes"
set modification date of theTransferredNote to myUpdateDate
end tell
end repeat
end tell

@amritbs
Copy link

amritbs commented Apr 30, 2016

This worked brilliantly for me. Thank you!

@afangel
Copy link

afangel commented Feb 23, 2017

Excuse my inexperience, but I can't seem to get it to work. Both scripts seem to run fine but they don't seem to find anything located in the "Notes" folder.

  • The notes of interest are all stored in a single notebook under my iCloud account.
  • My system language is set to Danish and as such the folder reference may need correction? I tried editing to "Noter" (Danish for note in plural) – also being the name of the notebook of interest.
  • I also tried navigating in to find the notes folder archive to shed light on the naming and its potential content, but the notes seem to be compiled in a bulk file.

Any input would be much appreciated.

Cheers

@Kul-92
Copy link

Kul-92 commented Aug 10, 2017

I am moving from ios to android, this worked perfectly! Thank you!

@hmiah101
Copy link

Hi guys,

Apologies for the noob question, how do I run the script? I'm pretty sure it's not as simple as downloading the zip file, extracting and running the script via Script Editor as that hasn't done the trick. Came across this tool and it sounds perfect for me to transfer over 800 of my notes to Evernote, but am stuck on how to do it :/

Would be very grateful if someone could kindly offer me some help. Thanks!

@sailisheth
Copy link

Worked perfectly! Thank You so Much!!

@shmendo
Copy link

shmendo commented Jan 31, 2020

If you have more than one account this no longer works. I cobbled together an applescript from the above and some apple resources that allows you to choose the account to import from and then it will import into Evernote.

tell application "Notes"
	set thisAccountName to my getNameOfTargetAccount("Choose an account:")
	tell account thisAccountName
		set theNotes to every note of the folder "Notes"
		repeat with thisNote in theNotes
			set myTitle to the name of thisNote
			log myTitle
			set myText to the body of thisNote
			set myCreateDate to the creation date of thisNote
			set myUpdateDate to the modification date of thisNote
			tell application "Evernote"
				set theTransferredNote to create note with html myText ¬
					title myTitle ¬
					created myCreateDate ¬
					notebook "Imported Notes"
				set modification date of theTransferredNote to myUpdateDate
			end tell
			log "imported note to evernote"
		end repeat
	end tell
end tell

on getNameOfTargetAccount(thisPrompt)
	tell application "Notes"
		if the (count of accounts) is greater than 1 then
			set theseAccountNames to the name of every account
			set thisAccountName to ¬
				(choose from list theseAccountNames with prompt thisPrompt)
			if thisAccountName is false then error number -128
			set thisAccountName to thisAccountName as string
		else
			set thisAccountName to the name of account 1
		end if
		return thisAccountName
	end tell
end getNameOfTargetAccount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment