On Sep 29, 2011, at 09:29, Michelle Steiner wrote: It appeared to me out of the blue that on Thu Sep 29 00:03:33 2011, Christopher Stone wrote these pearls of wisdom: tell application "Mail" tell (some message viewer whose index is 1) set selected mailboxes to {mailbox "INBOX" of account "geode" of application "Mail"}
Chris,
Is of application "Mail" necessary? I ask because it is inside tell application "Mail"
______________________________________________________________________
Hey Michelle,
If I pull the 'of application "Mail"' it throws an error:
"Mail got an error: Can’t set account "geode" of some message viewer whose index = 1 to {mailbox "INBOX" of account "geode" of some message viewer whose index = 1}."
Mail viewers understand mailboxes but not accounts, so I had to back the reference out to the application level.
I can write it like this and make Mail happy:
tell application "Mail" set geodeInbox to mailbox "INBOX" of account "geode" tell (some message viewer whose index is 1) set selected mailboxes to {geodeInbox} set msgList to messages whose read status is false repeat with theMsg in msgList set sub to theMsg's subject end repeat end tell end tell
OR
tell application "Mail" set mailApp to a reference to it tell (some message viewer whose index is 1) set selected mailboxes to {mailbox "INBOX" of account "geode" of mailApp} set msgList to messages whose read status is false repeat with theMsg in msgList set sub to theMsg's subject end repeat end tell end tell
-- Best Regards, Chris
|