Jump to content

jd007

Level 2
  • Posts

    17
  • Joined

  • Last visited

About jd007

Recent Profile Visitors

809 profile views

jd007's Achievements

0

Reputation

  1. I'm running El Capitan too. So why would the bug occur in El Cap if it's a Sierra bug?
  2. 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.
  3. @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
  4. @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")
  5. 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"
  6. tried this, got: error "Notes got an error: Can’t get selection." number -1728 from selection
  7. 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?
  8. @DTLow I found this script which works for me: https://gist.github.com/mshk/6276780 I then modified it to add a tag, and create a new Notebook in Evernote, i.e.: set listOfNames to {} set theFolder to choose folder "Select the source folder" tell application "Finder" set filelist to every file of the folder theFolder repeat with currentFile in filelist set currentFileName to (the name of currentFile) set nom to currentFileName if text -4 of nom is "." then set currentFileName to (text 1 thru -5 of nom) end if set currentFileDate to (the creation date of currentFile) set modFileDate to (the modification date of currentFile) set currentFileLocation to currentFile as alias set currentFileFolder to (the name of theFolder) tell application "Evernote" set theItem to create note title currentFileName tags ["imported_from_Notes"] created currentFileDate notebook "Imported From Notes" from file currentFileLocation set (modification date of theItem) to modFileDate end tell end repeat end tell
  9. @DTLow I just tried it and got the same error error "Evernote got an error: File does not exist." number 3
×
×
  • Create New...