Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@sailisheth
Copy link

sailisheth commented Dec 4, 2018

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