Jump to content
Introducing 'Templates' for Evernote Read more... ×
Notebook Limit Increase Read more... ×

Recommended Posts

I've got 400+ notes in Apple Mail.app.

What's the easiest way to import these into Evernote?

I tried the Import... feature, but this wouldn't let me select my notes mailbox, even after I tried to Archive the Notes mailbox.

Thanks!

Share this post


Link to post

If you can get Mail.app to export your notes as separate files (either RTF or plain text), you can then import these into Evernote by dragging them on to our dock icon. I tried selecting several notes and either copying or Save As from Mail.app, and it seemed to always want to create a single block of text in a file rather than multiple files.

Share this post


Link to post

Yes, that's exactly the problem. How do I get Apple Mail to export Notes into multiple files, preferably without all the email headers. Anybody have a script, or something to tear apart mbox files?

Share this post


Link to post

This is very easy in Ruby using appscript.

The main point is, the notes have to be dragged into a new mailbox. For whatever reason, the Notes "folder" doesn't exist where Mail's scripting is concerned. In this example, I made a new mailbox called "NoteMigrate" so it appeared under "On My Mac." The script will create a notebook called "ImportedMessages" if you don't have one already, and it will tag each note with "imported_note."

The first line of a given note is the 'subject.' All the lines of a note, including the first, are the content.


#!/usr/bin/ruby
require 'rubygems'
require 'appscript'
include Appscript

en = app("Evernote")
mail = app("Mail")

notes_folder = mail.mailboxes["NoteMigrate"]
messages = notes_folder.messages.get

messages.each do |m|
en.create_note(:title => m.subject.get,
:notebook => "ImportedNotes",
:with_text => m.content.get,
:tags => "imported_note")

end

I don't do much scripting with Applescript directly because I got more fluent with Ruby using rb-appscript much more quickly. The logic is so straightforward I'm sure an adept Applescripter will be able to translate it. If nobody shows how in a day or two, I'll do it.

  • Like 1

Share this post


Link to post

Well, it was pretty easy in AppleScript, too, since I had some scrap code from a while back. Same deal as before: Drag all the notes into a new mailbox called "NoteMigrate."

No error checking or anything. Worked for me:


tell application "Mail"
set theMessages to every message of the mailbox "NoteMigrate"
repeat with thisMessage in theMessages
set myTitle to the subject of thisMessage
set myText to the content of thisMessage
tell application "Evernote"
create note with text myText title myTitle notebook "Imported Notes" tags "imported_note"
end tell
end repeat
end tell

  • Like 2

Share this post


Link to post

Works great, but Is the created or last modified date available to add to this import code? That's pretty important sometimes, and the fact that Mail.app notes doesn't seem to track date created is one of the problems that motivated my search for Evernote.

Share this post


Link to post

You just need to grab the "date sent" attribute when you look at the original note, then add it as the "created" property to the newly created Evernote item.

The AppleScript version:

tell application "Mail"
set theMessages to every message of the mailbox "NoteMigrate"
repeat with thisMessage in theMessages
set myTitle to the subject of thisMessage
set myText to the content of thisMessage
set myCreateDate to the date sent of thisMessage
tell application "Evernote"
create note with text myText title myTitle notebook "Imported Notes" tags "imported_note" created myCreateDate
end tell
end repeat
end tell

The Ruby/rb-appscript version:

#!/usr/bin/ruby
require 'rubygems'
require 'appscript'
include Appscript

en = app("Evernote")
mail = app("Mail")

notes_folder = mail.mailboxes["NoteMigrate"]
messages = notes_folder.messages.get

messages.each do |m|
en.create_note(:title => m.subject.get,
:notebook => "ImportedNotes",
:with_text => m.content.get,
:tags => "imported_note",
:created => m.date_sent.get)

end

  • Like 1

Share this post


Link to post

Simply incredible. I've been trying to get my 250 notes from my old blackberry to my new imac and iphone for two months. Thanks so much.

Share this post


Link to post

Apple Script version: This worked great, but as a first time user of apple script, I had to figure out a few things.

1. Open up the application "Apple Script Editor."

2. Paste in the text from the post above.

3. Open Mail application. Control-click on "inbox" and make a "New Mailbox..." and name it "NoteMigrate."

4. Select all your notes and move them into the new folder "NoteMigrate."

5. Open Evernote app on your Mac. (not sure this is necessary, but I did it)

6. Go back to Apple Script Editor. Hit Compile. (not sure compile is necessary, but I did it)

7. Click the icon "Run."

8. Wait.

9. Go back to Evernote, and see the result.

10. Dance. (not sure this is necessary, but I did it)

  • Like 2

Share this post


Link to post

This method indeed rocks, but there's still one more detail before you get the full A+...

The capture of creation was a nice improvement, but many users also like to sort the notes based on date updated, from most recent to least recent, right?

The output from your script currently creates a rather awkward situation, since it actually reverses this order due to the fact that the "updated" date defined in Evernote for the newly imported notes is set by the order in which they are imported, and it seems that the script by default imports them starting from the most recently updated to least recent, as defined in the Mac's Note database. Once they land in evernote, they all have the correct original creation dates (lovely!), but they all have today's import date and time for their "updated" values (so they all differ by about 1 seoncd or so, as the script was walking through the list).

Tried a quick "dumb fix" of reversing the sort order in Mac Mail prior to import but this doesn't help, since it is just a viewing option: the script apparently follows the order set by the last modified date of these notes.

So I see two possible fixes, neither of which I can implment myself, as I don't know enough about scripting, so I'm greatly appreciate if one of you could help here:

-the smart fix: figure out how to capture the "last updated" values from the Mac database, and use them to reset the corresponding "updated" values in Evernote after the import is complete.

-the acceptable work-around: if resetting the "updated" values correctly is not possible, then you could maybe get the script to at least least reestablish the correct "updated" order by altering this order either before or after the import, by getting either Mac Mail or Evernote to go into each of the notes in the reverse order and adding a benign edit (e.g. an extra space or punctuation character at the very end of the note text field). This would result in the correct "udpated-based sorting", at the modest price of losing the actual last update dates from before the import process.

Make sense?

If so, I'd greatly appreciate if pdxmph (or anyone else with the right scripting know-how) would be wiling to update the script accordingly... Which would then get A+ rock status in my book as well... ;-)

Cheers!

Share this post


Link to post

To make the AppleScript version add in reverse order:

 

tell application "Mail"	set theOMessages to every message of the mailbox "NotesExport"	set theMessages to reverse of theOMessages	repeat with thisMessage in theMessages		set myTitle to the subject of thisMessage		set myText to the content of thisMessage		set myCreateDate to the date sent of thisMessage		tell application "Evernote"			create note with text myText title myTitle notebook "Imported Notes" tags "imported_note" created myCreateDate		end tell	end repeatend tell

Share this post


Link to post

When I run these scripts, after importing five notes, Evernote returns

 

 

Internal Error.

An internal database error has occurred that prevents Evernote from functioning properly.  If the problem persists, please contact Evernote Support.

 

 

Share this post


Link to post

What's happening is that Evernote balks at titles that are too long. I'm trying to figure out how to fix this.

Share this post


Link to post

Here's a fix I kludged up. I'd much rather have it pick, say, the first four words, but when I tried that it came out allruntogether, and I didn't see an easy way to remedy that.

 

 

tell application "Mail"

set theOMessages to every message of the mailbox "NotesExport"

set theMessages to reverse of theOMessages

repeat with thisMessage in theMessages

set myTitle to the subject of thisMessage

set myCount to count characters of myTitle

if myCount is greater than 20 then

set theTitle to characters 1 through 20 of myTitle as string

else

set theTitle to myTitle

end if

set myText to the content of thisMessage

set myCreateDate to the date sent of thisMessage

tell application "Evernote"

create note with text myText title theTitle notebook "Imported Notes" tags "iOS" created myCreateDate

end tell

end repeat

end tell

Share this post


Link to post

Modified this script to work with Mavericks Notes, which is no longer in the mail app.


Added the original creation and modification dates


Added multiple tags - replace with your own


 


Did not add the long note name fix (I needed to preserve my note names)


 


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


 


Enjoy


  • Like 5

Share this post


Link to post

I currently have over 500 notes on my Apple desktop computer in the app notes.

 

I want to move them into Evernote, as separate notes.

 

Having looked at the steps above, 

 

1. I can not get the Notes into my Mailbox, unless I do each one manually.

 

I think it may be the Maverick iOS edition as there is no option for showing notes in Mail.

 

 

Please could someone advise me on how I can get these Apple Notes on to Mail, then Mail to Evernote.

Thanks

Share this post


Link to post

I currently have over 500 notes on my Apple desktop computer in the app notes.

 

I want to move them into Evernote, as separate notes.

 

Having looked at the steps above, 

 

1. I can not get the Notes into my Mailbox, unless I do each one manually.

 

I think it may be the Maverick iOS edition as there is no option for showing notes in Mail.

 

 

Please could someone advise me on how I can get these Apple Notes on to Mail, then Mail to Evernote.

Thanks

You should be able to use d.b.walker's applescript posted in this very thread (two posts above yours). https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?p=236445

Share this post


Link to post

WOW!

 

Thank you very much d.b.Walker and ScottLougheed that just saved me a whole day!

 

Did not realise AppleScript worked like that.. AMAZING!

Share this post


Link to post

Found that not all of my 1500+ notes from Apple's Notes.app had delineated titles. Since the "title" of a note is generally the first line, I was getting errors from Evernote when it was trying to create notes with a title larger than 255 characters. I suppose you could truncate the title to only take the first 255 characters of the title, but I found that setting title to the creation date as a string was more clean. Hope this helps anyone running into the same problem!

tell application "Notes"	set theMessages to every note	repeat with thisMessage in theMessages		set myTitle to the creation date of thisMessage as string		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 myText title myTitle notebook "Imported" tags ["imported_from_Apple_notes"]			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 repeatend tell
  • Like 1

Share this post


Link to post

Thanks d.b.walker! It worked perfectly!

 

*Dale*

 

 

Modified this script to work with Mavericks Notes, which is no longer in the mail app.

Added the original creation and modification dates

Added multiple tags - replace with your own

 

Did not add the long note name fix (I needed to preserve my note names)

 

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

 

Enjoy

 

  • Like 1

Share this post


Link to post

I actually need to truncate the first 255 chars of the title. The script that set the first 20 didn't work...What would the code for that be?

 

Thanks in advance!

Share this post


Link to post

I'm using the script but it's giving me an ["... Connection is invalid." number -609] error. I end up with about 2/3rds of my 250 Notes imported. I can't see any pattern of which Notes are imported and which aren't.

 

Any suggestions?

 

 

Thanks d.b.walker! It worked perfectly!

 

*Dale*

 

 

Modified this script to work with Mavericks Notes, which is no longer in the mail app.

Added the original creation and modification dates

Added multiple tags - replace with your own

 

Did not add the long note name fix (I needed to preserve my note names)

 

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

 

Enjoy

 

 

Share this post


Link to post

Many thanks from a less than "Programming for Dummies" - level guy who had an intro course to C++ 15 years ago and never coded anything from then on. I was still able to follow procedure! Wow. Very proud of myself.

Share this post


Link to post

In case you have Notes from multiple accounts, like I do (some in iCloud, some on Exchange, etc.) you can add this line to pull the account name of the note:

set myAccount to the name of the container of the container of thisMessage

and then add this line in there to put it into a corresponding Evernote notebook:

​set myNote to create note with text myTitle title myTitle notebook myAccount tags ["Whatever", "Tags", "you", "want"]

 

Modified this script to work with Mavericks Notes, which is no longer in the mail app.

Added the original creation and modification dates

Added multiple tags - replace with your own

 

Did not add the long note name fix (I needed to preserve my note names)

 

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

 

Enjoy

 

  • Like 1

Share this post


Link to post

Hi! I am also interested in merging my Apple Notes to Evernote. Could someone explain exactly how to run this script in a step-by-step process for people who know nothing about coding, etc? I assume you cut and paste this, but to where? Then you run, and then what? You just open Evernote and everything is there? Could someone outline the exact process? I'm on Yosemite. I don't have any Notes name more than 255 characters. Thanks!

 

kevin

Share this post


Link to post

I currently have over 500 notes on my Apple desktop computer in the app notes.

 

I want to move them into Evernote, as separate notes.

 

Having looked at the steps above, 

 

1. I can not get the Notes into my Mailbox, unless I do each one manually.

 

I think it may be the Maverick iOS edition as there is no option for showing notes in Mail.

 

 

Please could someone advise me on how I can get these Apple Notes on to Mail, then Mail to Evernote.

Thanks

 

 

I compiled and created the Application for the beginners

 

http://artpromac.com/ExportNotetoEvernotebyArtProMac.zip

Share this post


Link to post

i can see this script importing my 550 notes to evernote... i trusted the .zip file listed on the link of the last post before me and its just beautifull!!! ( i didnt know where to start with the script)... i agree that the dates are an issue but i finally have acces to my notes so i dont care about the date!!! 

 

thanks to all of you!!! you really made my switch from ios to android finally possible! 

 

SgtYzi

Share this post


Link to post

I am running Yosemite (Mac OS X 10.10.1 and consequently Apple Notes 3.1 and with the script below I receive the error: "Syntax Error Notes got an error: AppleEvent handler failed." at line two with "every note" highlighted.

Can anyone help?

 

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", "Yosemite", "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

Share this post


Link to post

I am running Yosemite (Mac OS X 10.10.1 and consequently Apple Notes 3.1 and with the script below I receive the error: "Syntax Error Notes got an error: AppleEvent handler failed." at line two with "every note" highlighted.

Can anyone help?

 

tell application "Notes"

set theMessages to every note

. . .

 

You might try a Google on "applescript select all notes" since the issue seems to be in how you are trying to select all Notes.

Share this post


Link to post

Hi JMichael,

I cannot seem to find any apple script command for 'select all' in notes. But is that even possible? Surely there must be such a command. I can certainly select all notes manually in the notes app, so why would this scripting feature be absent?

Thanks ever so much for your help.

A.

Share this post


Link to post

I cannot seem to find any apple script command for 'select all' in notes. But is that even possible? Surely there must be such a command. I can certainly select all notes manually in the notes app, so why would this scripting feature be absent?

 

You could try using keyboard shortcuts. Something like this maybe:

 

tell application "Evernote"	activate -- bring the Evernote client forward	delay 1 -- wait to make sure the client has fully activated	tell application "System Events"		keystroke "|" using command down -- Cmd-| to go to the note list		keystroke "a" using command down -- Cmd-A to select all	end tellend tell

Share this post


Link to post

 

I cannot seem to find any apple script command for 'select all' in notes. But is that even possible? Surely there must be such a command. I can certainly select all notes manually in the notes app, so why would this scripting feature be absent?

 

You could try using keyboard shortcuts. Something like this maybe:

 

tell application "Evernote"	activate -- bring the Evernote client forward	delay 1 -- wait to make sure the client has fully activated	tell application "System Events"		keystroke "|" using command down -- Cmd-| to go to the note list		keystroke "a" using command down -- Cmd-A to select all	end tellend tell

I now see you were talking about the Notes app. A similar approach should work there too.

Share this post


Link to post

Sorry I'm such an applescript novice I've no idea how to include your suggestion. I've typed the following script out (and also tried to tweak it), but it gives me the following error: Expected end of line, etc. but found end of script.

 

tell application "Notes"

activate -- bring the Notes client forward

delay 1 -- wait to make sure the client has fully activated

tell application "System Events"

keystroke "|" using command down -- Cmd-| to go to the note list

keystroke "a" using command down -- Cmd-A to select all

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", "Yosemite", "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

Share this post


Link to post

Try this:

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", "Yosemite", "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 repeatend tell
  • Like 1

Share this post


Link to post

@Adjusting:  I can see that you are an accomplished AppleScript coder.  Could you please help us get the AppleScript issues with EN Mac 6.0.5 fixed?  Many of use routinely rely on AppleScript in our Evernote workflows.

 

Thanks.

Share this post


Link to post

@Adjusting:  I can see that you are an accomplished AppleScript coder.  Could you please help us get the AppleScript issues with EN Mac 6.0.5 fixed?  Many of use routinely rely on AppleScript in our Evernote workflows.

 

I’m good at debugging and modifying other people’s scripts, but I don’t know if I could write one from scratch.

 

The issue where find notes did not work with the 'notebook:' syntax should be fixed in 6.0.6 beta 2

Which other issues are affecting your workflows?

Share this post


Link to post

Thank you Adjusting, but I don't see how your script differs from the one I initially tried (see my post dated 18 Jan 10:30AM).

Apologies if it is different.

Share this post


Link to post

Thank you Adjusting, but I don't see how your script differs from the one I initially tried (see my post dated 18 Jan 10:30AM).

Apologies if it is different.

No, you’re right. There doesn’t seem to be any difference. I was just trying to fix the problems with your latest script (using keyboard shortcuts that don’t exist, using theMessages before setting it, mismatched tell and end...) and didn’t reread the whole thread.

What were you trying to accomplish with your latest script that your original didn’t do?

Share this post


Link to post

Hi Adjusting,

What I'm trying to do is the titler of this discussion.

"Importing from Apple Mail.app's Notes"

Except that - as you probably realise - Yosemite has its own stand alone Notes App, meaning notes in Yosemite are no longer stored in the Apple Mail App.
Hope that helps.
Many thanks

Share this post


Link to post

What I'm trying to do is the titler of this discussion.

"Importing from Apple Mail.app's Notes"

Except that - as you probably realise - Yosemite has its own stand alone Notes App, meaning notes in Yosemite are no longer stored in the Apple Mail App.

 

Right, but your original script already did that. I’m just trying to figure out what the goal of your changes was.

Share this post


Link to post

Excellent!  Worked perfectly. Thanks for posting this, Calion.

Here's a fix I kludged up. I'd much rather have it pick, say, the first four words, but when I tried that it came out allruntogether, and I didn't see an easy way to remedy that.

 

 

tell application "Mail"

set theOMessages to every message of the mailbox "NotesExport"

set theMessages to reverse of theOMessages

repeat with thisMessage in theMessages

set myTitle to the subject of thisMessage

set myCount to count characters of myTitle

if myCount is greater than 20 then

set theTitle to characters 1 through 20 of myTitle as string

else

set theTitle to myTitle

end if

set myText to the content of thisMessage

set myCreateDate to the date sent of thisMessage

tell application "Evernote"

create note with text myText title theTitle notebook "Imported Notes" tags "iOS" created myCreateDate

end tell

end repeat

end tell

Share this post


Link to post

This script will import all your Notes and create folders for each Account. For instance, if you have iCloud and a Gmail account, it will create "Imported iCloud" and "Imported Gmail" folders to store respective notes. It also sets mod date to the correct field. Thanks everyone for creating the base for this.

tell application "Notes"	set theNotes to every note	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 myModDate to the modification date of thisNote		set myFolder to the container of thisNote		set myAccount to the container of myFolder		set myAccountName to the name of myAccount		set myAccountName to "Imported " & myAccountName		set myAccountName to myAccountName as string		tell application "Evernote"			set myNote to create note with text myTitle title myTitle notebook myAccountName			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 repeatend tell

Share this post


Link to post

Nice work everyone - many thanks.

Has anyone figured how to include embedded images from your notes in Notes.app to the new Evernote note?

  • Like 1

Share this post


Link to post

Oh, My, Goodness! I can't believe that I just figured out how to do this!  Thank you SOOOO much for putting the notes here.  I have spent at least 1.5 hours trying to figure out something that "should" be simple - just download about 30 notes from my MacBook Notes to Evernote.  I "ran the script" that you suggested, and I am not sure what it really did, but now I see all these notes in Evernote.  Now, if my computer starts smoking, and little bugs start running out, I will know that it didn't work as well as I think, but thanks so much!  I feel so proud of myself, because I think I just "programmed" my computer, or something like that!!

Thanks again, Evernote geeks!

 

 

Share this post


Link to post

 

Modified this script to work with Mavericks Notes, which is no longer in the mail app.

Added the original creation and modification dates

Added multiple tags - replace with your own

 

Did not add the long note name fix (I needed to preserve my note names)

 

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

 

Enjoy

 

How do I do this in Mavericks? Run in Apple Script Editor? Does Evernote need to be open?

Share this post


Link to post

Nice work everyone - many thanks.

Has anyone figured how to include embedded images from your notes in Notes.app to the new Evernote note?

Thanks for the work of all.

Any news of that issue? I can not figure out how to export the body (text) + attachments (images) of Notes.app to Evernote.

 

Best

Share this post


Link to post

This thread is awesome and d.b.walker your script is amazing and worked like a charm- it did in seconds something which would have taken me hours to do manually. 

Share this post


Link to post

Worked like a charm, for all of my different accounts in the notes app ( local, gmail, icloud)

Cheers to you, sir!

 

 

This script will import all your Notes and create folders for each Account. For instance, if you have iCloud and a Gmail account, it will create "Imported iCloud" and "Imported Gmail" folders to store respective notes. It also sets mod date to the correct field. Thanks everyone for creating the base for this.

tell application "Notes"	set theNotes to every note	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 myModDate to the modification date of thisNote		set myFolder to the container of thisNote		set myAccount to the container of myFolder		set myAccountName to the name of myAccount		set myAccountName to "Imported " & myAccountName		set myAccountName to myAccountName as string		tell application "Evernote"			set myNote to create note with text myTitle title myTitle notebook myAccountName			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 repeatend tell

Share this post


Link to post

The script in this thread was helpful, but some of the modification dates for my notes were not right after I imported them. I think there is a bug in the script. The line that says 

set the modification date of myNote to myCreateDate

should say 

set the modification date of myNote to myModDate

instead.

Share this post


Link to post
On 3/24/2016 at 11:24 PM, Elias Zamaria said:

 I think there is a bug in the script.

Good catch!  Thanks for reporting.

@d.b.walker, if you are still around, could you please update your post/script to fix this bug so others do not encounter it.

Since that script is the one and only post of @d.b.walker, I suspect he may not be active in the forum.

So, I'm posting his code, with the bug fix identified by @Elias Zamaria, to make it easy for others to find in the future.
From the original script by @d.b.walker, with bug fix:

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 myModDate -- BUG FIX
    end tell
    
  end repeat
end tell

NOTE:  I have not tested this code, so I can NOT vouch for it.  Use at your own risk.

Share this post


Link to post

I've made a minor adjustment to this code, it preserves folders and account by making a new notebook for each folder (within an account) and tags the account the note is associated with. This can be easily switched if you prefer your notebooks to be based on accounts and tagged with the folders. 
 

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
		set thisItem to thisMessage
		set myAccount to null
		set myFolder to null
		repeat
			set thisContainer to the container of thisItem
			if (the class of thisContainer) is folder then
				set myFolder to name of thisContainer
			else if (the class of thisContainer) is account then
				set myAccount to name of thisContainer
			end if
			if myFolder is not null and myAccount is not null then
				exit repeat
			else
				set thisItem to thisContainer
			end if
		end repeat
		tell application "Evernote"
			set myNote to create note with text myTitle title myTitle notebook myFolder tags myAccount
			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

 

 

if you want to make the notebook names from accounts and the tags from folders (opposite of what I have), you would change "set myNote to create note with text myTitle title myTitle notebook myFolder tags myAccount" to "set myNote to create note with text myTitle title myTitle notebook myAccount tags myFolder".

  • Like 2

Share this post


Link to post

Thank you Matthew. For some reason, none of the HTML or attachments in my Notes get exported to Evernote with your script or the original script, just the plain text, title, and dates. A lot of my notes have HTML links to the original web pages I created them from. How can i migrate that?

Share this post


Link to post
On 9/1/2017 at 8:20 PM, Matthew Sangster said:

I've made a minor adjustment to this code, it preserves folders and account by making a new notebook for each folder (within an account) and tags the account the note is associated with. This can be easily switched if you prefer your notebooks to be based on accounts and tagged with the folders. 
 


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
		set thisItem to thisMessage
		set myAccount to null
		set myFolder to null
		repeat
			set thisContainer to the container of thisItem
			if (the class of thisContainer) is folder then
				set myFolder to name of thisContainer
			else if (the class of thisContainer) is account then
				set myAccount to name of thisContainer
			end if
			if myFolder is not null and myAccount is not null then
				exit repeat
			else
				set thisItem to thisContainer
			end if
		end repeat
		tell application "Evernote"
			set myNote to create note with text myTitle title myTitle notebook myFolder tags myAccount
			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

 

 

if you want to make the notebook names from accounts and the tags from folders (opposite of what I have), you would change "set myNote to create note with text myTitle title myTitle notebook myFolder tags myAccount" to "set myNote to create note with text myTitle title myTitle notebook myAccount tags myFolder".

works amazing 

can you make all of the attached pictures and pdf inside the notes to transfer to?
this will be wonderful  

Share this post


Link to post

please people I am willing to donate money for this
it is very important to me

ill send you money via PayPal 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×