I scan physical mail into Notes.app for archiving. I use the Notes app on my iPhone to do this. Works great, except that the name of the attachment is derived from the content scanned in and 100% of the time makes no sense. So I've been tinkering with AppleScript to rename the attachment to be the same as the title of the note. Although it's possible in the app to rename an attachment, AppleScript does not seem to support this feature.

So my current thinking is that I create a new note, and copy content over from the original. This works just fine with the title and body. But I am not sure how to get the attachment copied over.

set firstAttachment to the first attachment of oldNote
set newNote to make new note at theFolder with properties {name:"Copy of " & (name of oldNote), body:(body of oldNote)} 
make new attachment at newNote [....]

One less elegant approach is keystrokes, but I'm not a fan of that. Another less elegant approach is to save the attachment of oldNote to the filesystem with the desired name, and then add it back into newNote. I've found code that claims to do that.

But I already hold the attachment data in firstAttachment inside the script.

Surely there is a way to add it to newNote?


You must log in to answer this question.

Browse other questions tagged .