Re: scripting mail to select mailboxes
Re: scripting mail to select mailboxes
- Subject: Re: scripting mail to select mailboxes
- From: "David P. Baker" <email@hidden>
- Date: Thu, 13 Mar 2003 14:25:37 -0500
OK, but please take a look at the code I sent you in my last email. It
doesn't appear to have that problem. I'll copy it here for convenience.
Please tell me what is wrong with it. Note that I don't get an error
(as I perhaps would if it were a containment hierarchy problem); it
just fails silently.
tell application "Mail" to get selected mailboxes of message viewer 1
-- {mailbox "Loft" of account "email@hidden" of
application "Mail"}
tell application "Mail"
set theBox to mailbox "Stuff" of account "email@hidden"
set selBoxes to {theBox}
set selected mailboxes of message viewer 1 to selBoxes
get selected mailboxes of message viewer 1
end tell
-- {mailbox "Loft" of account "email@hidden" of
application "Mail"}
Also, the Mail dictionary has drafts mailbox and sent mailbox as part
of the application class, not the message viewer class as you describe.
So I'm still confused. Can you try to replicate my problem? Thanks.
--dpb
On Thursday, March 13, 2003, at 02:00 PM, cricket wrote:
In your first posting, you had this line:
tell app "Mail"
set selected mailboxes of message viewer 1 to {drafts mailbox, sent
mailbox, mailbox "Stuff" of account "email@hidden"}
end tell
This is functionally equivalent to this code:
tell app "Mail"
tell message viewer 1
set selected mailboxes to {drafts mailbox, sent mailbox, mailbox
"Stuff" of account "email@hidden"}
end tell
end tell
The problem here is that 'drafts mailbox' and 'sent mailbox' are part
of the message viewer class, but mailbox is part of the account class
(for mailboxes that belong to an account) or the application class
(for mailboxes that don't belong to an account -- i.e. On My Mac).
You need to ask for the mailbox within either an application tell
block or an account tell block. Inside a message viewer tell block
won't work.
- cricket
On Wednesday, March 12, 2003, at 7:50 PM, David P. Baker wrote:
Sorry, I don't understand. I'm not inside a "tell message viewer"
block. I'm inside a "tell application 'Mail'" block. Here's a test
script, showing output. How should I be doing this? Note that this
works IF the new mailbox is a "standard" mailbox (in, out, drafts,
sent, or trash).
tell application "Mail" to get selected mailboxes of message viewer 1
-- {mailbox "Loft" of account "email@hidden" of
application "Mail"}
tell application "Mail"
set theBox to mailbox "Stuff" of account "email@hidden"
set selBoxes to {theBox}
set selected mailboxes of message viewer 1 to selBoxes
get selected mailboxes of message viewer 1
end tell
-- {mailbox "Loft" of account "email@hidden" of
application "Mail"}
On Wednesday, March 12, 2003, at 05:18 PM, cricket wrote:
On Wednesday, March 12, 2003, at 1:20 PM, David P. Baker wrote:
set selected mailboxes of message viewer 1 to {trash mailbox, in
mailbox}
get selected mailboxes of message viewer 1
-- {in mailbox, trash mailbox}
set selected mailboxes of message viewer 1 to {drafts mailbox, sent
mailbox, mailbox "Stuff" of account "email@hidden"}
get selected mailboxes of message viewer 1
-- {in mailbox, trash mailbox}
The mailbox class is part of the account class, so it won't work if
nested in a 'tell message viewer' block. So, try this:
set theMailbox to mailbox "Stuff" of account "email@hidden"
tell message viewer 1
set selected mailboxes to {drafts mailbox, sent mailbox, }
get selected mailboxes
end tell
Applescript is strict about containment hierarchy.
- cricket
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
See? We even have to whisper. It's a whole new world.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
In theory, there is no difference between theory and practice. In
practice, however, there is.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.