Q: Save Attachment script gives error "Mail got an error: AppleEvent handler failed." number -10000
Hi All,
I am completely ignorant when it comes to Apple Script and I am trying to get this simple script to work. The goal of the script is to save the attachments to a designated folder when I run it on selected Apple Mail messages through a rule.
This is the code:
tell application "Mail"
set theMessages to selection
repeat with thisMessage in theMessages
set theAttachments to thisMessage's mail attachments
repeat with thisAttachment in theAttachments
set theAttachmentFileName to ((path to home folder rule type rich text) & "Documents:Hazel Processing Folder") & thisAttachment's name
save thisAttachment in file theAttachmentFileName
end repeat
end repeat
end tell
The folder does exist but I receive a "error "Mail got an error: AppleEvent handler failed." number -10000" when I run it.
The code editor in Script Editor also inserts "rule type" in my code so I assume that my syntax is faulty.
Any assistance would be greatly appreciated.
Regards,
Beem
iMac (21.5-inch, Late 2013), Mac OS X (10.7.5)
Posted on May 9, 2016 12:16 PM
