I can select mailboxes in mail.app but I can’t select a smart folder.
Here’s what I can do. I can get the name of a selected mailbox box by selecting something in the left column of mail and running the following script…
tell application "Mail"
set firstMessageViewer to first message viewer
set theSelection to selected mailboxes of firstMessageViewer
end tell
Using the mailbox name from the above I can make that selection whenever I want. For example to select the inbox…
tell application "Mail"
set firstMessageViewer to first message viewer
set selected mailboxes of firstMessageViewer to {inbox}
end tell
So using that technique I can select many things in mail like the inbox, or the trash, junk mail etc. I can select those things for specific accounts only too. But there are several things I can’t select. A smart folder is one of them. When I try to get the name of a selected smart mailbox using the first script it doesn’t give me a mailbox name - and therefore I don’t know how to select it. Any ideas?
I also can’t select RSS feeds, the main ToDo item, or the main Notes item. Any ideas about those would be helpful too.