Re: Accessing/creating mailboxes in Mail.app
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. |
_______________________________________________
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