• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Selecting all mailboxes in a Mail message viewer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting all mailboxes in a Mail message viewer


  • Subject: Re: Selecting all mailboxes in a Mail message viewer
  • From: Christopher Stone <email@hidden>
  • Date: Sun, 09 Sep 2012 22:15:15 -0500

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

 _______________________________________________
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

  • Follow-Ups:
    • Re: Selecting all mailboxes in a Mail message viewer
      • From: Shane Stanley <email@hidden>
References: 
 >Selecting all mailboxes in a Mail message viewer (From: David Duncan <email@hidden>)
 >Re: Selecting all mailboxes in a Mail message viewer (From: Christopher Stone <email@hidden>)
 >Selecting all mailboxes in a Mail message viewer (From: David Duncan <email@hidden>)
 >Re: Selecting all mailboxes in a Mail message viewer (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Selecting all mailboxes in a Mail message viewer
  • Next by Date: Re: Selecting all mailboxes in a Mail message viewer
  • Previous by thread: Re: Selecting all mailboxes in a Mail message viewer
  • Next by thread: Re: Selecting all mailboxes in a Mail message viewer
  • Index(es):
    • Date
    • Thread