• 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: Opening Smart Mailbox in Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening Smart Mailbox in Mail


  • Subject: Re: Opening Smart Mailbox in Mail
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 14 Dec 2008 12:12:34 -0600

On Dec 10, 2008, at 12:22 PM, Roy McCoy wrote:

I have a smart mailbox named "Unread" in Mail 3.5 (OS X 10.5.5 on a MacBook Pro) containing messages that match the condition "Message is Unread".

It's probably possible to script opening a mailbox easily, and thus also (hopefully) a smart mailbox, but

I've just tried to do this and either I missed something or a smart mailbox can't be opened. Mail's dictionary does not contain the word "smart".


You can open (select) a mailbox with something like this ...

tell application "Mail"
activate
set frontViewer to (some message viewer whose index is 1)
set selected mailboxes of frontViewer to {mailbox "fullpathname_of_mailbox"}
end tell


provided the mailbox is a REAL mailbox. If you use the name of a Smart Mailbox, the last line errors with: "Mail got an error: AppleEvent handler failed."

If you try this ...

	tell application "Mail"
		activate
		set frontViewer to (some message viewer whose index is 1)
		set mailBoxList to (selected mailboxes of frontViewer) as list
		set mbox to item 1 of mailBoxList
		display dialog (name of mbox) as text
	end tell

A selected smart mailbox, with any name, will return the name "Mail".

This probably has something to do with the fact that a Smart Mailbox is not really a mailbox, it's a search result and does not really contain messages. If you look in the folder /Users/username/Library/ Mail/ you will find message files associated with a mailbox located in various sub-folders such as "Mac-username", "Mailboxes" or "POP- emailaddress".

There are no message files associated with a Smart Mailbox, however. The Smart Mailboxes are described in the file SmartMailboxes.plist in the Mail folder.

So, I don't think you can script a smart mailbox. Or, maybe I missed something.

_______________________________________________
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
References: 
 >Sequential renumbering in InDesign CS3 (From: Andrew Brown <email@hidden>)
 >Opening Smart Mailbox in Mail (From: Roy McCoy <email@hidden>)

  • Prev by Date: Re: What's so great about AppleScript, anyway?
  • Next by Date: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Previous by thread: Opening Smart Mailbox in Mail
  • Next by thread: Re: Opening Smart Mailbox in Mail
  • Index(es):
    • Date
    • Thread