I'm working on a script that copies Apple Mail mails into Apple Notes. So far so good, but I am having troubles getting the attachments into the newly created note. This is on macOS Catalina 10.15.7.
I spent half a day yesterday looking for solutions, but they all do not work.
When I execute a make new attachment
statement, I get the following kind of error for each attachment found in the email: Notes got an error: Can’t make show id "x-coredata://32E6D9EF-97F3-424F-B151-DD166A00E0AB/ICNote/p9725" into type specifier.
This UID is the same for each attachment.
I tried various path variations (as POSIX file, as text, or just as is) but all give the same error.
This simple code example already gives the error on line 2:
set theNote to make new note at folder NotesFolder with properties {body:theBody}
make new attachment at theNote with data theFileName
where theFileName is the complete path to the email-attachment, temporarily saved in a folder on the desktop so Applescript and Notes can have access to it.
Since the UID in the error message is the same for every found attachment, it can also be that theNote
is not ok.
Any ideas what is wrong with this? Or is it Notes having problems (I've read that Notes in Catalina seems to have Applescripting bugs)
I'm at a loss, currently, so any help is much appreciated.
Can you create an attachment like so specifying your folder, account, and note id: