On Sep 09, 2012, at 20:26, Shane Stanley < email@hidden> wrote: To be fair, it doesn't have to be convoluted -- or at least it doesn't here. This does the same thing: tell application "Mail" set selected mailboxes of message viewer 1 to (get every mailbox of application "Mail") end tell
Maybe Chris was working around some other problem.
______________________________________________________________________
Okay. I was tired this morning when I wrote that.
The fact is that you still need the some message viewer reference, because if you have more than one viewer open the front one won't be used if it was opened later than the one(s) behind it. (Nasty bug.)
tell application "Mail" tell (some message viewer whose index is 1) set selected mailboxes to (get mailboxes of application "Mail") end tell end tell
David. The base Applescript language is very meat and potatoes, but when you start dealing with application dictionaries the complexity level goes up and sometimes WAY up.
Two good training tools are Tex-Edit Plus (inexpensive and non-crippled, no time-limit shareware) and TextWrangler (freeware).
This morning I gave you a hint to find the other available mailboxes, but I was doing other things and didn't want to mess with it.
I've had a nap now and taken a fresh look. This should do the job:
set mailBoxList to {} tell application "Mail" set acntMailBoxList to mailboxes of every account repeat with i in acntMailBoxList set mailBoxList to mailBoxList & (get contents of i) end repeat set mailBoxList to mailBoxList & mailboxes tell (some message viewer whose index is 1) set selected mailboxes to mailBoxList end tell end tell
There are a variety of things broken in Mail-scripting as well as some glaring omissions, so don't hold it up as your example scripting model.
-- Best Regards, Chris
|