Re: Error getting mail attachments
Re: Error getting mail attachments
- Subject: Re: Error getting mail attachments
- From: "S. J. Cunningham" <email@hidden>
- Date: Thu, 15 Dec 2016 04:34:13 -0500
On Dec 14, 2016, at 9:37 PM, David Crowe wrote:
> I used to be able to get mail attachments and manipulate them, but now (El Capitan, Mail 9.3) I cannot. Here is a script that illustrates the problem:
>
>
> tell application "Mail"
> set theList to selection --> {message id 91500 of mailbox "INBOX" of account "IFAST" of application "Mail"}
> repeat with aMessage in theList
> return mail attachments of aMessage --> error "Mail got an error: AppleEvent handler failed." number -10000
> end repeat
> end tell
>
>
> The first comment indicates that there is a single message selected in this case, so the repeat loop just executes once, and generates the error message shown in the second comment. Even if the mail message had no attachments (and it has several, in the example I was using), I don’t believe it would be correct.
>
Don't know if this is the problem here but I frequently run into problems with "lists" of one item because what is returned is not a list if there is only one item. Particularly with the Finder. I usually do a "if count of…" test to catch it.
Steve
------------------
OS X 10.6.8, AppleScript 2.1.2
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden