Hello
I'm getting a puzzling behavior.
Most of the time, the code below - part of a large script - behaves flawlessly.
tell application "Mail" activate set theMessage to item 1 of (get selection)
get every mail attachment of theMessage # code saving the attached files on disk
end tell
But, from time to time, and I don't understand why, although the first message selected has attachment(s), the instruction trying to get them fails with : get every mail attachment of message id 52016 of mailbox "INBOX" of account "iCloud" error "Erreur dans Mail : Le gestionnaire AppleEvent a échoué." number -10000
It's puzzling because I may drag and drop - by hand - the attached file on the desktop or in an other folder Of course, I may enclose the instruction in a try … end try block but in such case the script would fail to save the attachments.
At this time, I create a report file listing the messages behaving this odd way and save the attachments by hand but it's not satisfying.
The attachments for which I got this odd behavior are PDF and/or JPG files of around 300,000 bytes which is not a huge size.
I have no example of such behavior for messages received thru my . mac.com account but most of the messages received thru this one behave flawlessly. Here is an example of normal result : {mail attachment id "1.2" of message id 58836 of mailbox "INBOX" of account "iCloud" of application "Mail", mail attachment id "2" of message id 58836 of mailbox "INBOX" of account "iCloud" of application "Mail"}
Any idea ?
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 30 décembre 2015 16:27:10
|