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 post
  • 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 post
  • 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 post
  • 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 post
  • 1 month later...
  • 3 months later...
  • 1 month later...
  • 3 months later...

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?

Link to post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
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 post
  • 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 post
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 post
  • 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 post
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 post

@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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
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 post
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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post
  • 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 post

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 post
  • 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 post

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 post
  • 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 post
  • 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 post
  • 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 post

@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 post
  • 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 post

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