This seems like a simple task but I haven’t been able to find an example anywhere. All attachment examples seem to be for saving an attachment. I want to delete one. This is for Mail.app on Leopard.
I’ve got the code working to pull messages and to pull attachments for messages. I’ve got the code working to select the exact attachments I want to delete but can’t figure out how to actually delete the attachment.
This doesn’t work:
delete mail attachment (id of theAttachment)
delete mail attachment theAttachment
Is this even possible?
welcome to MacScripter
It’s not possible to delete attachments with Mail’s dictionary.
The only way is to call the menu item of the Message Menu with GUI scripting
Well, not the answer I was looking for but thanks for the information. If it’s not possible to delete a specific attachment, is it possible to delete all of them? If that’s the menu item you were talking about, how do I select the message with Applescript so the menu will apply to the message?
the property selection in Mail.app is read only, you can’t select messages easily with an AppleScript command.
maybe it’s also possible with UI scripting, but I’ve never tried to do that