Jump to content

How to import Apple Notes to Evernote


Go to solution Solved by BigRedling,

Recommended Posts

Although I have not tried it yet, I found this:

 

http://jeremyrnelson.wordpress.com/2014/01/19/importing-apple-notes-into-evernote/

 

If you cannot get this to work, you can export each Apple Note as PDF documents then import into Evernote.  That can be done using an "Import Folder" as described here:  http://jeremyrnelson.wordpress.com/2014/01/19/importing-apple-notes-into-evernote/

 

In either case, using Applescript will probably be your best bet.  I hope this helps.

Link to comment
  • 1 year later...
  • Solution

Sentinel's link to the AppleScript worked great for me on El Capitan! I love how it even got the dates!

 

https://jeremyrnelson.wordpress.com/2014/01/19/importing-apple-notes-into-evernote/

 

However, there were a few changes I made to the script. I changed the smart quotes to straight quotes. I changed the "set the modification date of myNote to myCreateDate" to "set the modification date of myNote to myModDate". And I found all of the extra tags unnecessary, so I just used the tag "Imported from Notes" Also, Apple Script Editor is now called Script Editor, found in the Utilities folder.

 

Below is my modified script, tested and it worked! Just copy and paste into Script Editor and hit the Run button and watch the magic right before your eyes!

 

 

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"]
 
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
 
end tell
  • Like 7
  • Thanks 1
Link to comment
  • 1 month later...
  • 1 month later...

Thanks for those links Sentinel / Big Redling! Seamless indeed! 
Now I don't have to worry about looking in the wrong place for that one note.
I'm starting to like Apple Script Editor more and more. Though (as a front-end-developer) I still find the whole natural-language-syntax hard to get used to!

Link to comment
  • Level 5*

Just so everyone knows, the original author of this script referred to by Sentinel and Big Redling is @d.b.walker

See 

EDIT:  2016-03-28  15:32 CT -- Changed below code to make BUG fix, as identified by:

For easy reference, I have cleaned up the formatting issues caused by the new forum update, and provided here:

(*
====================================================
  [EN] Import Apple Notes into Evernote
====================================================

DATE:    2013-10-24
AUTHOR: d.b.walker

REVISED BY:  JMichaelTX on 2016-03-28 to make BUG fix

REF:
  • Importing from Apple Mail.app's Notes - Mac Help - Evernote User Forum       
  • https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?do=findComment&comment=236445

Posted 24 Oct 2013
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 myModDate  -- ## BUG FIX BY JMichaelTX ##
      
    end tell
    
  end repeat
  
end tell

 

Link to comment
  • 1 month later...
  • 3 months later...
  • 1 month later...
  • 3 months later...
  • 3 weeks later...

I've found this script very useful in shifting about 1000 Notes notes, but I have encountered another problem:

If you have Notes notes with HTML code snippets in them (and I had quite a few) the HTML gets stripped out in the import process. Any way round this?

 

Link to comment
  • 2 months later...

How come, instead of importing, we actually create a way to mirror and/handoff Apple Notes with Evernote?

If Evernote could view my Apple Notes, and if Apple Notes could accept my changes made within Evernote, then I would renew my Premium Subscription.  Notes does what I need, but Evernote has many more appreciable features that are worth the Premium price, IF AND ONLY if the two formats can sync with one another.  Otherwise, I risk duplicating my efforts by keeping two separate formatting programs.  (Just as 2Do syncs with Apple Reminders).  

(I work at an office whose IT team blocks Evernote from our network...but I am allowed to access iCloud.com, which of course contains Apple Notes).  It would be nice to do my work (at the office) in Notes, and see the sync on my home Mac, so as to utilize the full functionality from home with reminders, lists, etc).

Link to comment
  • 3 weeks later...
On 11/29/2016 at 7:46 AM, finchy said:

The problem with any of these, and I've seen this same script in about 10 different places  now, is that it doesn't handle attachments.  Is there no way to move the attachments in Notes.app over to Evernote?

yep, this.

Link to comment
  • Level 5*
On 2017-03-19 at 7:47 AM, jd007 said:

yep, this.(Is there no way to move the attachments in Notes.app over to Evernote?)

Just a quick look at the above script.  
It can be modified on the Apple Notes side to save the attachments from the Apple Note
save .... in .....    edited: problems are being reported with saving attachments
On the Evernote side, the attachments can be imported
append ..... attachment ....

Link to comment
1 minute ago, DTLow said:

Just a quick look at the above script.  
It can be modified on the Apple Notes side to save the attachments from the Apple Note
On the Evernote side, the attachments can be imported
 

Really? Wow.. might give it a go, but don't want to test with all my Notes notes.. is there a way to modify so that it only uses a particular folder of notes, for example? 

Link to comment
  • Level 5*
On 2017-03-19 at 7:57 AM, jd007 said:

Really? Wow.. might give it a go, but don't want to test with all my Notes notes.. is there a way to modify so that it only uses a particular folder of notes, for example? 

The script currently runs with:   set theMessages to every note
I haven't tested this but you should be able to:   set theMessages to selection

edited: I haven't followed up on this but there's a report that Selection is not valid for Apple Notes

Link to comment
19 minutes ago, DTLow said:

The script currently runs with:   set theMessages to every note
I haven't tested this but you should be able to:   set theMessages to selection

tried this, got:   error "Notes got an error: Can’t get selection." number -1728 from selection

Link to comment
  • Level 5*
21 minutes ago, jd007 said:

tried this, got:   error "Notes got an error: Can’t get selection." number -1728 from selection

I don't want to take the time to debug this
How about limiting the note selection, as in 

set theMessages to every note whose name contains "Testing"

Link to comment
6 minutes ago, DTLow said:

I don't want to take the time to debug this
How about limiting the note selection, as in 

set theMessages to every note whose name contains "Testing"

Appreciate you don't want to debug. As for your suggestion, that's not going to work in the long run for me to select a folder of notes to export, as I would have to separately enter name of each note. (I just want to avoid exporting all notes, so trying to work out a way to do it with a selection or a folder.)

I did use it to test one note though, got as far as the attachment line. (save att in attFile)

error "The variable att is not defined." number -2753 from "att"

Edited by jd007
Link to comment

@DTLow, do you have any suggestions for resources/places where I can learn about these Applescript commands, particularly regarding Notes.app, so I can debug this and figure it out myself? I'm a newbie to scripting but would like to learn how to do this. Thanks.

I'm wondering if this particular one doesn't work since Apple changed Notes from being hosted by an email account, to iCloud. (The script refers to "theMessages")

 

Link to comment
  • Level 5*
1 hour ago, jd007 said:

do you have any suggestions for resources/places where I can learn about these Applescript commands, particularly regarding Notes.app, so I can debug this and figure it out myself? I'm a newbie to scripting but would like to learn how to do this

I learn best from existing scripts like the one posted above

This reference might help https://www.macosxautomation.com/applescript/notes/index.html It describes scripting the Notes app, and the dictionaries in the script editor

>>I just want to avoid exporting all notes, so trying to work out a way to do it with a selection or a folder.

Still checking the Selection thing; I found this on Folder

tell application "Notes"
    set myFolder to first folder whose name = "FolderA"
    set myNotes to notes of myFolder
    repeat with theNote in myNotes
        -- insert your code here
    end repeat
end tell
Link to comment
  • 2 weeks later...

@DTLow, I posted the original script above on MacScripter forum to ask for help there. Nigel Garvey came up with the following, which works to get notes exported from Notes app and into Evernote, from a selected folder, however the attachments aren't coming across yet. (They are being saved in folders). The guys on that forum don't have Evernote so can't test that part of it. Can you take a quick look and see what you think might be at fault in the Evernote section? Evernote creates the note, it knows there should be an attachment there as it shows the box with question mark icon, it just doesn't attach it.

 

(*

    ====================================================

      [EN] Import Apple Notes into Evernote

    ====================================================

    

    DATE:    2013-10-24

    AUTHOR: d.b.walker

    

    REVISED BY:  JMichaelTX on 2016-03-28 to make BUG fix. <https://discussion.evernote.com/topic/64814-apple-notes-app/#comment-395941>

    

    REF:

      • Importing from Apple Mail.app's Notes - Mac Help - Evernote User Forum       

      • https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?do=findComment&comment=236445

    

    Posted 24 Oct 2013

    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)

    ====================================================

    

    FURTHER DEVELOPED BY: Nigel Garvey 2017-03-21/22/23, based on information in the Evernote fora, to allow a choice of Notes source folder(s) and to handle attachments.

    

    CAVEATS:

        1. I don't have Evernote and can't test that part of the code.

        2. (No longer relevant. Thanks to Yvan Koenig for the fix.)

        3. Any attachments are simply "appended" to the Evernote notes in the order they happen to be returned by Notes.

        4. The effect in Evernote of Notes's references to the attachments in the note HTML is unknown.

*)

 

main()

 

on main()

    -- User choice of one or more Notes folders (by name).

    tell application "Notes"

        activate

        set folderNames to name of folders

        set chosenFolderNames to (choose from list folderNames with multiple selections allowed)

        if (chosenFolderNames is false) then error number -128 -- Cancel button.

    end tell

    

    -- Preset HFS and POSIX versions of a path to a folder on the desktop for storing any attachments.

    set tempFolderPath to (path to desktop as text) & "Attachments from Notes:"

    set tempFolderPosix to quoted form of POSIX path of tempFolderPath

    

    -- Repeat with each chosen folder name:

    repeat with i from 1 to (count chosenFolderNames)

        -- Get all the notes in the folder with this name.

        set thisFolderName to item i of chosenFolderNames

        tell application "Notes" to set theNotes to notes of folder thisFolderName

        set quotedFolderName to quoted form of thisFolderName

        

        -- Repeat with each note in the folder:

        repeat with j from 1 to (count theNotes)

            set thisNote to item j of theNotes

            

            tell application "Notes"

                -- Get the relevant note data.

                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 myAttachments to the attachments of thisNote

                

                -- Any attachments will need to be extracted to the folder on the desktop and attached to the Evernote note from there.

                -- To preserve the attachment names and avoid confusion in the case of duplicated names, each attachment is saved to a separate subfolder in a hierarchy based on the folder/note/attachment structure. 

                set attachmentFiles to {}

                set attachmentCount to (count myAttachments)

                if (attachmentCount > 0) then

                    -- If this note has any attachments, create or add to the hierarchy of the folder on the desktop to accommodate each one.

                    do shell script ("mkdir -p " & tempFolderPosix & quotedFolderName & "/'Note '" & j & "/'Attachment '{1.." & attachmentCount & "}")

                    

                    -- Repeat with each attachment:

                    repeat with k from 1 to attachmentCount

                        set thisAttachment to item k of myAttachments

                        -- Put together a specifier for a file in which to save this attachment.

                        set thisFile to (tempFolderPath & thisFolderName & ":Note " & j & ":Attachment " & k & ":" & thisAttachment's name) as «class furl»

                        -- Create the file before trying to save to it. (Suggested by Yvan Koenig.)

                        close access (open for access thisFile)

                        -- Save the attachment to it.

                        save thisAttachment in thisFile -- Now it works! Thanks, Yvan!

                        -- Store the file specifier for the retrieval of the attachment below.

                        set end of attachmentFiles to thisFile

                    end repeat

                    

                end if

            end tell

            

            tell application "Evernote"

                

                set myNote to create note with text myTitle title myTitle notebook "Imported From Notes" tags ["imported_from_notes"]

                set the HTML content of myNote to myText

                

                repeat with thisFile in attachmentFiles

                    tell myNote to append attachment thisFile

                end repeat

                

                set the creation date of myNote to myCreateDate

                set the modification date of myNote to myModDate

                

            end tell

            

        end repeat

        

    end repeat

end main

 

 

Link to comment
  • Level 5*
4 hours ago, jd007 said:

Nigel Garvey came up with the following, which works to get notes exported from Notes app and into Evernote, from a selected folder, however the attachments aren't coming across yet.

Please post the link to MacScripter.net post where the script is located.  Sometimes copy/paste of a script into a forum like this one can present problems.

 

Link to comment
  • Level 5*
14 hours ago, jd007 said:

I posted the original script above on MacScripter forum to ask for help there. Nigel Garvey came up with the following, which works to get notes exported from Notes app and into Evernote, from a selected folder, however the attachments aren't coming across yet. (They are being saved in folders).

So, can you see the attachment files from the Notes app in folders on your Mac?
If so, can you successfully attach these files to an EN Note manually?
Are you getting any errors from the Script?

Link to comment
  • Level 5*
On 2017-03-28 at 7:00 PM, jd007 said:

however the attachments aren't coming across yet. (They are being saved in folders)

I'm looking into this now
It looks like the attachments are not being saved from Notes - the script just creates an empty file
In Evernote, the empty file gets added as an attachment, hence "the box with question mark icon"

Link to comment
17 hours ago, JMichaelTX said:

So, can you see the attachment files from the Notes app in folders on your Mac?
If so, can you successfully attach these files to an EN Note manually?
Are you getting any errors from the Script?

Wow, I thought the attachment files were being successfully saved, I had looked and seen them there.. but just now I actually tried to view one of them, and there isn't actually a file there.. just an icon that is zero bytes.

No, no errors from the script.

Link to comment
4 hours ago, DTLow said:

I'm looking into this now
It looks like the attachments are not being saved from Notes - the script just creates an empty file
In Evernote, the empty file gets added as an attachment, hence "the box with question mark icon"

Yes, it is an empty file.

Link to comment
  • Level 5*
4 hours ago, jd007 said:

Wow, I thought the attachment files were being successfully saved, I had looked and seen them there.. but just now I actually tried to view one of them, and there isn't actually a file there.. just an icon that is zero bytes.

ok - we can focus on the issue of the "save thisAttachment in thisFile" not working

Also, this is overly complex, saving the entire set of attachments and then importing them
The statement  "set myAttachments to the attachments of thisNote" is sufficient
When creating the Evernote Note, pass through the myAttachments list and work on each attachment individually

Link to comment
  • Level 5*
On 3/28/2017 at 9:00 PM, jd007 said:

I posted the original script above on MacScripter forum to ask for help there. Nigel Garvey came up with the following, which works to get notes exported from Notes app and into Evernote, from a selected folder, however the attachments aren't coming across yet.

Based on the discussion at  http://macscripter.net/viewtopic.php?id=45602 , it looks like this is a macOS Sierra bug, with no workarounds for now.  Sorry, I can't test or explore solutions since I'm still running macOS El Capitan 10.11.6.

  • Like 1
Link to comment
  • Level 5*
13 hours ago, jd007 said:

I'm running El Capitan too. So why would the bug occur in El Cap if it's a Sierra bug?

Perhaps I misunderstood the MacScripter.net discussion.  I don't normally use Apple Notes, but when I get a chance I'll try to do some testing.

The first test needs to be just Apple Notes.  Can you, via AppleScript, save a Note's attachments to a file.

Link to comment
  • 10 months later...
On 1/31/2016 at 5:42 PM, JMichaelTX said:

 

Thanks to you JMichaelTX, d.b.walker, Big Redling and everyone who contributed to this script. Here we are in 2018, I'm using MacOS High Sierra, and the script worked perfectly. I was dreading the thought of having to copy/paste all of my Notes into Evernote. Hooray for scripters!

Link to comment
  • 3 months later...
On 2/1/2016 at 1:42 AM, JMichaelTX said:

Just so everyone knows, the original author of this script referred to by Sentinel and Big Redling is @d.b.walker

See 

EDIT:  2016-03-28  15:32 CT -- Changed below code to make BUG fix, as identified by:

For easy reference, I have cleaned up the formatting issues caused by the new forum update, and provided here:


(*
====================================================
  [EN] Import Apple Notes into Evernote
====================================================

DATE:    2013-10-24
AUTHOR: d.b.walker

REVISED BY:  JMichaelTX on 2016-03-28 to make BUG fix

REF:
  • Importing from Apple Mail.app's Notes - Mac Help - Evernote User Forum       
  • https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?do=findComment&comment=236445

Posted 24 Oct 2013
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 myModDate  -- ## BUG FIX BY JMichaelTX ##
      
    end tell
    
  end repeat
  
end tell

 

To anyone who comes across this thread, (May 2018) I used the script above, posted and modified by the guys above. it 100% worked. Just imported 200 notes to Evernote in 40 seconds. Life saver. Thank you.

  • Like 2
  • Thanks 1
Link to comment
  • 1 year later...

Bit of a Hail Mary, but is there any way to import notes from Apple Notes, to Evernote, and keep the notes organised in their original folders. Not all notes in a single Evernote Notebook

I have hundreds of notes in about 20 different folders. Would like to keep them organised on import to Evernote.

 

Thanks

Link to comment
  • Level 5*
32 minutes ago, ROK&ROLL said:

Bit of a Hail Mary, but is there any way to import notes from Apple Notes, to Evernote, and keep the notes organised in their original folders. Not all notes in a single Evernote Notebook

I have hundreds of notes in about 20 different folders. Would like to keep them organised on import to Evernote.

Yes, the script can be modified to retrieve the notes folder and assign an Evernote Notebook

Something like

     set myfolder to container of thisMessage

      set the notebook of myNote to myfolder

  • Like 1
Link to comment

Thank you - script below.

 

-

 

tell application "Notes"

 
set theMessages to every note
 
repeat with thisMessage in theMessages
 
set myfolder to container of thisMessage
 
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"]
 
set the HTML content of myNote to myText
 
set the notebook of myNote to myfolder
 
set the creation date of myNote to myCreateDate
 
set the modification date of myNote to myModDate
 
end tell
 
end repeat
 
end tell
Link to comment
  • Level 5*
On 7/22/2019 at 7:25 AM, ROK&ROLL said:

script below.

I got your script working with the following changes

    set myfolder to container of thisMessage
     change to  set mycontainer to container of thisMessage
                         
set myfolder to name of mycontainer as string

      tell application "Evernote" 
      added         if (not (notebook named myfolder exists)) then create notebook myfolder

       set myNote to create note with text myTitle title myTitle notebook "Imported Notes" tags ["Imported from Notes"]
       change
 to   set myNote to create note with text myTitle title myTitle notebook myfolder tags ["Imported from Notes"]

       set the notebook of myNote to myfolder
       omit - the notebook is set when the note is created

Link to comment

Thank you working on this.

With the changes you recommended. I get the error below.

Syntax Error

Expected end of line, etc. but found identifier.

My full script with changes below

-

 

tell application "Notes"

 

 set theMessages to every note

 

repeat with thisMessage in theMessages

 

set mycontainer to container of thisMessage

 

set myfolder to name of mycontainer as string

 

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"

 

if (not (notebook named myfolder exists)) then create notebook myfolder

 

set myNote to create note with text myTitle title myTitle notebook myfolder tags ["Imported from 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

 

end tell

 

Link to comment
  • Level 5*
9 minutes ago, ROK&ROLL said:

Thank you working on this.

With the changes you recommended. I get the error below.

Syntax Error

Expected end of line, etc. but found identifier.

The error occurs on     set myNote to create note with text myTitle title myTitle notebook myfolder tags ["Imported from Notes"]
It looks valid, but there may be some hidden characters in your code

I was able to clear the error by retyping    with text 

Link to comment
  • Level 5*

You're welcome

I hope you're not disenchanted with Applescript.  It's a useful tool and I use many scripts to automate tasks in Evernote and other apps

Link to comment
  • 3 months later...

Hey guys,

Here's the version that works with OS X 10.15 Catalina and the latest Evernote.

tell application "Notes"
 	activate
 	set folderNames to name of folders
 	set chosenFolderNames to (choose from list folderNames with multiple selections allowed)
 	if (chosenFolderNames is false) then error number -128 -- Cancel button.
end tell

repeat with i from 1 to (count chosenFolderNames)
 	set thisFolderName to item i of chosenFolderNames
 	tell application "Notes" to set theNotes to notes of folder thisFolderName
 	set quotedFolderName to quoted form of thisFolderName
 	
 	repeat with j from 1 to (count theNotes)
 		tell application "Notes"
 			set myTitle to the name of note j
 			set myText to the body of note j
 			set myCreateDate to the creation date of note j
 			set myModDate to the modification date of note j
 			
 		end tell
 		
 		tell application "Evernote"
 			set myNote to create note with text myTitle title myTitle notebook "Imported From 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
end repeat

It doesn't save any attachments - you have to remove them from your notes first, otherwise the script won't run. But apart from that, it works just fine. Hope you find it useful :) 

  • Like 1
  • Thanks 2
Link to comment

@Terell thank you for modifying/updating this little script for Catalina!  i'm not a scripter but i do understand how to put it in the Script Editor, Compile it, & run it. when i do, it imports from "all iCloud" instead of the folder(s) i choose.  oddly though, it does seem to be looking in to the folder i choose at least to gather the number of notes within that folder; then it imports that number of notes, just not from the chosen folder but from the main list.

any suggestions/thoughts on this?

thanks.

Link to comment
  • Level 5*
8 hours ago, ColinK said:

I get this error when I run it: "error "Notes got an error: AppleEvent handler failed." number -10000". 

Any ideas how to fix it? 

This is an Notes/Applescript issue; we're waiting for Apple to fix it

Info at https://hookproductivity.com/help2/integration/hook-and-macos-10-15-catalina-notes-app/

Link to comment

still hoping to get a revision to @Terell script. i'm NOT getting any error messages, my issue is different (as described). if this is still a symptom of the hookproductivity bug description, then ok, but i have a sliver of hope still since Terell got it working.

On 11/14/2019 at 3:16 PM, SyberKnight said:

it imports from "all iCloud" instead of the folder(s) i choose.  oddly though, it does seem to be looking in to the folder i choose at least to gather the number of notes within that folder; then it imports that number of notes, just not from the chosen folder but from the main list.

 

Link to comment
  • 3 months later...
  • 4 weeks later...

GREAT. Worked without issue. Great to see some code that actually works - half the code posted is nonsense and never tested.

 

Thanks Again. Now I can forget about trying to staddle the APPLE and android worlds as this usually craps out at some point.  Apple Macs and Oppo Android phone

 

Link to comment
  • 3 months later...
On 11/10/2019 at 10:11 PM, Terell said:

Hey guys,

Here's the version that works with OS X 10.15 Catalina and the latest Evernote.


tell application "Notes"
 	activate
 	set folderNames to name of folders
 	set chosenFolderNames to (choose from list folderNames with multiple selections allowed)
 	if (chosenFolderNames is false) then error number -128 -- Cancel button.
end tell

repeat with i from 1 to (count chosenFolderNames)
 	set thisFolderName to item i of chosenFolderNames
 	tell application "Notes" to set theNotes to notes of folder thisFolderName
 	set quotedFolderName to quoted form of thisFolderName
 	
 	repeat with j from 1 to (count theNotes)
 		tell application "Notes"
 			set myTitle to the name of note j
 			set myText to the body of note j
 			set myCreateDate to the creation date of note j
 			set myModDate to the modification date of note j
 			
 		end tell
 		
 		tell application "Evernote"
 			set myNote to create note with text myTitle title myTitle notebook "Imported From 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
end repeat

It doesn't save any attachments - you have to remove them from your notes first, otherwise the script won't run. But apart from that, it works just fine. Hope you find it useful :) 

I get an error error "Notes got an error: AppleEvent handler failed." number -10000 

On macOS 10.15.6

Any ideas thanks

Link to comment
  • 3 weeks later...

Hey everyone, 

I couldn't get the script here to work, so decided to write a new one. 

I followed this very useful tutorial here to get started https://macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html

The difference is, my script will let you choose which folder in Notes that you want to export (you can multi select) then it will create it as a Notebook in Evernote. 

This works on macOS Catalina 10.15.6. 

Follow the steps in the link above but use this code instead. Enjoy :) 

// set things up
var app = Application.currentApplication();
app.includeStandardAdditions = true;

var notesApp = Application('Notes');
notesApp.includeStandardAdditions = true;

var enApp = Application('Evernote');
enApp.includeStandardAdditions = true;


// choose which notes
//var notes = notesApp.folders;
var folders = notesApp.accounts.byName('iCloud').folders;


var whichFolders = app.chooseFromList(folders.name(), { withPrompt: "Which Folders?", multipleSelectionsAllowed: true });

if (whichFolders) {

	// loop through all folders
	for(var i=0; i<folders.length; i++) {
	
		// is this folder one to be exported?
		if (whichFolders.indexOf(folders[i].name()) > -1) {
	
			var foldername = folders[i].name();
	
			var notebook = enApp.createNotebook(foldername);
			
			// get notes in the folder 
			var notes = folders[i].notes;
			
			for(var j=0; j<notes.length; j++) {
				
				var name = notes[j].name();		
				var html = notes[j].body();
				var creationDate = notes[j].creationDate();
				var modificationDate = notes[j].modificationDate();

				var enNote = enApp.createNote({ title: name, withHtml:html, created: creationDate, notebook: notebook});
				enNote.modificationDate = modificationDate;
			}
	
		}
	
	}

}

 

  • Like 1
Link to comment
On 11/11/2019 at 11:11 AM, Terell said:

Hey guys,

Here's the version that works with OS X 10.15 Catalina and the latest Evernote.


tell application "Notes"
 	activate
 	set folderNames to name of folders
 	set chosenFolderNames to (choose from list folderNames with multiple selections allowed)
 	if (chosenFolderNames is false) then error number -128 -- Cancel button.
end tell

repeat with i from 1 to (count chosenFolderNames)
 	set thisFolderName to item i of chosenFolderNames
 	tell application "Notes" to set theNotes to notes of folder thisFolderName
 	set quotedFolderName to quoted form of thisFolderName
 	
 	repeat with j from 1 to (count theNotes)
 		tell application "Notes"
 			set myTitle to the name of note j
 			set myText to the body of note j
 			set myCreateDate to the creation date of note j
 			set myModDate to the modification date of note j
 			
 		end tell
 		
 		tell application "Evernote"
 			set myNote to create note with text myTitle title myTitle notebook "Imported From 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
end repeat

It doesn't save any attachments - you have to remove them from your notes first, otherwise the script won't run. But apart from that, it works just fine. Hope you find it useful :) 

Worked for me like charm on Catalina 10.15.4

Thanks a lot for this.

Link to comment
  • 2 weeks later...
On 8/30/2020 at 7:44 PM, Mike8471 said:

Hey everyone, 

I couldn't get the script here to work, so decided to write a new one. 

I followed this very useful tutorial here to get started https://macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html

The difference is, my script will let you choose which folder in Notes that you want to export (you can multi select) then it will create it as a Notebook in Evernote. 

This works on macOS Catalina 10.15.6. 

Follow the steps in the link above but use this code instead. Enjoy :) 


// set things up
var app = Application.currentApplication();
app.includeStandardAdditions = true;

var notesApp = Application('Notes');
notesApp.includeStandardAdditions = true;

var enApp = Application('Evernote');
enApp.includeStandardAdditions = true;


// choose which notes
//var notes = notesApp.folders;
var folders = notesApp.accounts.byName('iCloud').folders;


var whichFolders = app.chooseFromList(folders.name(), { withPrompt: "Which Folders?", multipleSelectionsAllowed: true });

if (whichFolders) {

	// loop through all folders
	for(var i=0; i<folders.length; i++) {
	
		// is this folder one to be exported?
		if (whichFolders.indexOf(folders[i].name()) > -1) {
	
			var foldername = folders[i].name();
	
			var notebook = enApp.createNotebook(foldername);
			
			// get notes in the folder 
			var notes = folders[i].notes;
			
			for(var j=0; j<notes.length; j++) {
				
				var name = notes[j].name();		
				var html = notes[j].body();
				var creationDate = notes[j].creationDate();
				var modificationDate = notes[j].modificationDate();

				var enNote = enApp.createNote({ title: name, withHtml:html, created: creationDate, notebook: notebook});
				enNote.modificationDate = modificationDate;
			}
	
		}
	
	}

}

 

Thank you so much! I was trying to do this for the last 5 days and your script worked like a charm!

Link to comment
  • 2 weeks later...
  • 1 month later...

Hi All, is there a way to include the name of the note as a body in Evernote? I understand Evernote uses the first paragraph as the title and then excludes that from the body?

I have some Apple notes such as below where the first paragraph is quite long. Picture 1

 

image.png.2d0488bc796f1a04e4cb84235230c9a2.png

 

When this is moved to Evernote - only the first 15 words or so appear in Evernote title and the body of the note is empty Picture 2

 

I am okay with the title being truncated. I just need for the first paragraph to appear in the body in Evernote too. Many thanks in advance.

 

2080934633_Screenshot2020-10-30at09_45_33.thumb.png.7dbb4bc3a71e8da56e60251e1d47758c.png

Link to comment
  • Level 5*
1 hour ago, Everlast24 said:

I understand Evernote uses the first paragraph as the title and then excludes that from the body?

What method are you using to  move your notes to Evernote?

  • Like 1
Link to comment
6 hours ago, DTLow said:

What method are you using to  move your notes to Evernote?

 

Thanks DTLow. I have used the below version

 

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
Link to comment
  • Level 5*
3 minutes ago, Everlast24 said:

I have used the below version

You're using a script that copies the note title from Apple Notes title
Why do you "understand Evernote uses the first paragraph as the title and then excludes that from the body?"

  • Like 1
Link to comment
19 minutes ago, DTLow said:

You're using a script that copies the note title from Apple Notes title
Why do you "understand Evernote uses the first paragraph as the title and then excludes that from the body?"

Yes, apologies I realised I need to elaborate a bit more on this.

Apple notes do not have a designated title field. I understand this code picks Apple's title (first paragraph) and turns it into an Evernote title. 

The issue is Apple's first paragraph not appearing anywhere else. This becomes a problem when that paragraph is too long and gets truncated as an Evernote title.  So I wonder if it is possible to include that first paragraph also in Evernote's body of text?

Apologies, if it still sounds confusing.

Link to comment
On 8/30/2020 at 3:44 PM, Mike8471 said:

Hey everyone, 

I couldn't get the script here to work, so decided to write a new one. 

I followed this very useful tutorial here to get started https://macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html

The difference is, my script will let you choose which folder in Notes that you want to export (you can multi select) then it will create it as a Notebook in Evernote. 

This works on macOS Catalina 10.15.6. 

Follow the steps in the link above but use this code instead. Enjoy :) 


// set things up
var app = Application.currentApplication();
app.includeStandardAdditions = true;

var notesApp = Application('Notes');
notesApp.includeStandardAdditions = true;

var enApp = Application('Evernote');
enApp.includeStandardAdditions = true;


// choose which notes
//var notes = notesApp.folders;
var folders = notesApp.accounts.byName('iCloud').folders;


var whichFolders = app.chooseFromList(folders.name(), { withPrompt: "Which Folders?", multipleSelectionsAllowed: true });

if (whichFolders) {

	// loop through all folders
	for(var i=0; i<folders.length; i++) {
	
		// is this folder one to be exported?
		if (whichFolders.indexOf(folders[i].name()) > -1) {
	
			var foldername = folders[i].name();
	
			var notebook = enApp.createNotebook(foldername);
			
			// get notes in the folder 
			var notes = folders[i].notes;
			
			for(var j=0; j<notes.length; j++) {
				
				var name = notes[j].name();		
				var html = notes[j].body();
				var creationDate = notes[j].creationDate();
				var modificationDate = notes[j].modificationDate();

				var enNote = enApp.createNote({ title: name, withHtml:html, created: creationDate, notebook: notebook});
				enNote.modificationDate = modificationDate;
			}
	
		}
	
	}

}

 

This worked previously for me on 10.15.6, but I now get an error of: "Error -1708: Message not understood" on 10.15.7. 

Link to comment
  • 2 weeks later...
  • 2 weeks later...
On 10/30/2020 at 5:40 PM, Everlast24 said:

Yes, apologies I realised I need to elaborate a bit more on this.

Apple notes do not have a designated title field. I understand this code picks Apple's title (first paragraph) and turns it into an Evernote title. 

The issue is Apple's first paragraph not appearing anywhere else. This becomes a problem when that paragraph is too long and gets truncated as an Evernote title.  So I wonder if it is possible to include that first paragraph also in Evernote's body of text?

Apologies, if it still sounds confusing.

@DTLowany suggestions how I could include the first paragraph also in the body of the text?

Thanks in advance.

Link to comment
  • Level 5*
On 11/17/2020 at 2:55 PM, Everlast24 said:

@DTLowany suggestions how I could include the first paragraph also in the body of the text?

When retrieving the contents of the Apple Note, all paragraphs are included in the body of the text   
No special processing is required to "include the first paragraph"

Link to comment
  • Level 5*
31 minutes ago, lov3likerockets said:

@DTLowDo you have any suggestions here? I tried on a computer that is on 10.14.6 and experienced the same error, "Error -1708: Message not understood". So it seems to be related to an update to Evernote itself. 

This script works

tell application "Notes"
     
set folderNames to name of folders of account "On My Mac"
     
repeat with thisfolderName in folderNames
          
set theNotes to notes of folder thisfolderName of account "On My Mac"
          
tell account "On My Mac"
               
tell folder thisfolderName
                    
repeat with j from 1 to (count theNotes)
                         
set theNote to note j
                         
set myTitle to get the name of note j
                         
set myText to get the body of note j
                         
set myCreateDate to the creation date of note j
                         
set myModDate to the modification date of note j

                         
tell application "Evernote"
                              
set myNote to create note with text myTitle title myTitle notebook "Imported --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 -- BUG FIX
                        
end tell
                    
end repeat
              
end tell
          
end tell
      e
nd repeat
end tell

Link to comment
  • 1 month later...

I get the error:

Syntax Error

Expected end of line but found application constant or consideration.

Then, it highlights the word note after the word create. 

I'm not experienced in applescript at all, so I am not sure what I'm missing. Am I supposed to just copy/paste your script there into automator or applescript and then hit run?

Link to comment
  • 2 months later...

Help!  I am a complete newb.  I used the following script to import my notes from Apple notes into evernote and it was populating evernote but then got an error.

 

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

 

 

ERROR - 

error "Evernote got an error: Can’t continue create note." number -1708

 

Does anybody know how to fix?

 

PS:  I updated the web app version of evernote in the middle of this transfer, not sure if this had anything to do with it or not.

 

Thanks in advance!

Link to comment

Recent Update:

1. Delete current Evernote App

2. Download and install Evernote Legacy App

3. Open Script Editor

4. Paste

tell application "Notes"
     
set folderNames to name of folders of account "On My Mac"
     
repeat with thisfolderName in folderNames
          
set theNotes to notes of folder thisfolderName of account "On My Mac"
          
tell account "On My Mac"
               
tell folder thisfolderName
                    
repeat with j from 1 to (count theNotes)
                         
set theNote to note j
                         
set myTitle to get the name of note j
                         
set myText to get the body of note j
                         
set myCreateDate to the creation date of note j
                         
set myModDate to the modification date of note j

                         
tell application "Evernote"
                              
set myNote to create note with text myTitle title myTitle notebook "Imported --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 -- BUG FIX
                        
end tell
                    
end repeat
               
end tell
          
end tell
      e
nd repeat
end tell

5. If your notes are in iCloud, change in script "On My Mac" to "iCloud" in all place. Change "Evernote" to "Evernote Legacy"

6. Press Play icon to run the script.

7. Wait for the magic.

8. If you wish after sync delete Evernote Legacy and download/install latest Evernote app back.

9. Enjoy

  • Like 2
Link to comment
  • 1 year later...

Nothing works with Evernote 10. Evernote 10 is garbage, web page in a Electron wrapper, just to lower development costs. Nothing more. It can be done good enough if wanted (Slack, Visual Studio Code, ...), but EN v10 isn't one of them.

Scripts work with Legacy and latest Apple Notes.

Sorry for the rant :D, I just really don't like Electron, being a developer myself. Electron should be a kickoff thing for an initial project, but not a mature project to degrade their software. My 2 cents or something.

I was looking to move from AN, have been a EN user on-and-off from 2008, but not probably not returning this time. Notion, OneNote, or many self-hosted alternatives (Carnet, PaperWork, ...) come to mind.

Link to comment
  • Level 5

Whatever - you needed a lot of words to answer a simple question.

Thanks for the modified script. Apple Notes should have a solid export by itself, but this is nothing Apple would be famous for. When moving stuff into the ecosystem, it runs down like water, when you try to extract it, it is more like carrying stones to the top of a mountain.

  • Like 1
  • Thanks 1
Link to comment

Yup, that is the way :D. Easy in - pain out. AN is solid for basic needs which kinda is the majority for many, but when cross platform is needed, then it's not a great option (that's why I looked this thread in the first place)

Was in a ranty mood and kinda sad by the development decisionw which limit me from moving to EN due the whole electron thingy (e.g no support for scripting). I still have a soft spot for EN :), will try it some more.

The Apple Script still throws some weirdness, when AN has big attachments (I have videos :)), but overall it runs smoothly.

  • Thanks 1
Link to comment
  • Level 5

For me (and this is always specific to the use cases) the new EN system works better than the old one ever had. It still has some traps, but up to now most initial issues has been addressed and ironed out. The progress on the iOS app has been the largest (tables, tasks, Home, ...), although IMHO it still needs multitasking ability on the iPad to really shine. No Android devices, so I have no own insight into this part of the setup.

About the decision to move to Electron: I think it is based on a simple calculation. If you have to keep up yourself with OS changes, you have a major release on every platform every year, with Win10 and 11 now even 2 of them for the PC. This makes 5 major changes, plus a lot of smaller releases as the year passes by.

If you do all the adaption yourself, you probably end up with a large percentage of your devs just working on following the OS changes. While it was legacy my impression was that nearly 100% of the devs work went into just keeping it up and running. For me as a user all this is wasted effort - necessary but not adding value.

The embedding into a framework changes this equation. It is licence fees for the OS work, and your own team can focus on the app itself. Plus the framework being practically a VM-environment allows for code sharing in a much larger extend. It has downsides as well, but for the majority of users I think it is a strategic step forward.

It is all about finding a good allocation of resources - I really doubt EN has been doing it to cut cost. At least they are hiring, if you go to their career pages.

Link to comment
  • 2 weeks later...

I ended up using Evernote too :). Trying hard to ignore the Electron part. Anyway. M1 1000 notes, w/o errors, 10m, syncing time depends on your internet connection. I had ~200 notes on a M1 and had bunch of errors (too large attachment), did it about ~2m.

Link to comment
  • 2 weeks later...
On 4/28/2022 at 12:08 PM, PinkElephant said:

Whatever - you needed a lot of words to answer a simple question.

Thanks for the modified script. Apple Notes should have a solid export by itself, but this is nothing Apple would be famous for. When moving stuff into the ecosystem, it runs down like water, when you try to extract it, it is more like carrying stones to the top of a mountain.

That's why I am moving from apple. I feel trapped. 

  • Like 1
Link to comment
  • 2 months later...

I just tried the latest version of the script that was posted here, with one of my Apple Notes folders.

While all the notes were transferred properly, and the "attachments from notes" folder was created on my desktop, including all subfolders for notes with attachments, there are some major issues with it, which will prevent me from using this script to migrate:

  • most of the attachment subfolders are empty. Only "real" attachments like PDFs or JPGs will arrive there. Other attachments like e.g. "scanned documents" didn't show there, the respective folders remained empty (but the fact that there was in fact an attachment folder created for that particular note shows that an attachment was recognized as such).
  • The numbering of the attachment folders by running numbers only makes it incredibly cumbersome to identify the proper note that the attachment belongs to - think of several hundred of notes to be migrated or more. Attachment subfolders named after the note they came from would be a phantastic enhancement...providing all attachments were there in the first place.

I'm not familiar with scripting on the Mac, therefore I can only comment or make suggestions. Maybe someone familiar with scripting wants to dig into that?

---------------------------------------------------------------------------------------------------------------------------------

P.S. I don't know if the Evernote people read this. But in the absence of a feedback system (at least I didn't find one), here is my message to E: after a year or so with Apple Notes, and still missing some of the E features, I would very much like to move back to E, as a paying user. However, without a proper importing tool, I won't be able to do that. Currently I have a little less than 1000 notes stored in Apple Notes, so exporting them note by note manually won't work for me.

 

I think that developing (or officially supporting) an import tool would pay off big time for E., as it would allow many users like myself to go (back?) to Evernote.

---------------------------------------------------------------------------------------------------------------------------------

P.P.S. I just became aware of the feature request forum and will post my request for an import tool there too.

Link to comment
5 minutes ago, PinkElephant said:

Have you tried with v10, or with the legacy client ?

Apple has done a lot of work on the Notes app, so maybe the script gets confused.

I don't know where to find a version number, I downloaded the script from the latest post here (April 26), and the last comment in it also says 2022-04-26

Yes I used the legacy client.

I know Apple changed a lot in Notes, and understand maintaining such a script or a tool is a p.i.t.a. These 'scanned documents' came from docs that I took a picture of within Notes, which then got synced via iCloud, in a Notes internal format. Yes I can manually & separately from the note export this attachment as a PDF, but like I said, this gets almost impossible if you have hundreds of such notes or more.

 

Link to comment
  • Level 5

File menu, About Evernote 

If the version number starts with a 10.xx.x, it is version 10 (currently 10.42.7). This version does not allow scripting.

If the version number starts with a 7 (7.14), it is legacy, and that is what should be used when scripting is on the table.

It can be installed in parallel to v10.

Link to comment
  • Level 5

OK, if this does not produce the desired results, the script may need an overhaul. I would expect the problem more on the Apple Notes side, because they really did a lot to improve it. They likely needed to upgrade the data model to reach these improvements, and probably the script is not up to the new structure.

Link to comment

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
×
×
  • Create New...