On May 5, 2012, at 12:24 PM, Luther Fuller wrote: You may need to refer to a mailbox by its full path name. If you have mailbox "A" at the top level which contains mailbox "H" which contains mailbox "Z", then you have to refer to mailbox "Z" as mailbox A/H/Z.
I haven't done this in a while, so Im not completely sure. Some experimenting is in order.
So, I did some experimenting ...
tell application "Mail" set frontViewer to (some message viewer whose index is 1) set mboxList to (selected mailboxes of frontViewer) set mbox to (item 1 of mboxList) --> «class mbxp» "Outer_Box/Middle_Box/Inner_Box" -- name of mbox --> "Inner_Box"
my getMailboxLongName(mbox) end tell
on getMailboxLongName(mbox) tell application "Mail" set mboxLongName to (name of mbox) set mboxContainer to mbox repeat try set mboxContainer to (container of mboxContainer) set mboxLongName to (name of mboxContainer) & "/" & mboxLongName on error return mboxLongName end try end repeat end tell end getMailboxLongName --------------------------
Notice that the value of mbox contains the long name of the mailbox and it would be nice to be able to read that string, but I don't see how to do that in a one-liner.
So, I wrote the getMailboxLongName handler to do that.
The the slash-delimited string returned by this handler is understood by Mail and you CAN select a mailbox with this ...
tell application "Mail" activate set frontViewer to (some message viewer whose index is 1) set selected mailboxes of frontViewer to {} delay 1 beep delay 1 set selected mailboxes of frontViewer to {mailbox "Outer_Box/Middle_Box/Inner_Box"} end tell
|