• 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: Accessing/creating mailboxes in Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing/creating mailboxes in Mail.app


  • Subject: Re: Accessing/creating mailboxes in Mail.app
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 1 Jan 2011 21:51:08 -0600

On Jan 01, 2011, at 09:11, Luther Fuller wrote:
Some more info. This script will select a mailbox ...

tell application "Mail"
activate
set selected mailboxes of message viewer 1 to {mailbox "MailboxName/sub_MailboxName/sub_sub_MailboxName"}
end tell
______________________________________________________________________

Hey Luther,

Keep in mind that 'message viewer 1' does not refer the the front message viewer.  If you have more than one open you can get into trouble using that syntax.  (Mail continues to be an ugly beast to script.)

This works reliably on Mac OS 10.6.5:

tell application "Mail"
try
set frontWindowID to id of front window
set mvIdList to id of windows of message viewers
if frontWindowID is in mvIdList then
set mvList to message viewers where its window's id is frontWindowID
end if
if mvList ≠ {} then
set frontMessageViewer to item 1 of mvList
end if
tell frontMessageViewer
set selectedMailboxes to selected mailboxes
end tell


on error errMsg number errNum
"Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell

If anyone is aware of a better way I'd love to know.

** Note that Mail continues to be unable to return a 'Smart Mailbox' as a selected mailbox.

--
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: Accessing/creating mailboxes in Mail.app
      • From: Luther Fuller <email@hidden>
    • Re: Accessing/creating mailboxes in Mail.app
      • From: Axel Luttgens <email@hidden>
References: 
 >Re: Accessing/creating mailboxes in Mail.app (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Accessing/creating mailboxes in Mail.app
  • Next by Date: grep 2.7 & linked-images
  • Previous by thread: Re: Accessing/creating mailboxes in Mail.app
  • Next by thread: Re: Accessing/creating mailboxes in Mail.app
  • Index(es):
    • Date
    • Thread