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 10:04:38 -0500
Actually, I think I figured out that message viewer 1 is the first
message viewer in order of creation (in what must be an array of
viewers), but the WINDOWS are in front-to-back order (although the
dictionary says "back-to-front order"). So if message viewer A is the
front window, then window 1 = window of message viewer A. That should
clear up your problem with ordering of message viewers (although I wish
there were an easy way to navigate from window to message viewer, as
there is from message viewer to its window; then I could do something
like "if class of document of window 1 is message viewer then foo").
And again, I have no problem getting a reference to the correct message
viewer. I have no problem setting the selected mailboxes of that
message viewer to any subset of {in mailbox, out mailbox, drafts
mailbox, sent mailbox, trash mailbox}. No problems.
The ONLY problem (so far) is setting the selected mailboxes of a
message viewer to any list that includes a mailbox of the form mailbox
"abc" of account "def". In that case, the selected mailboxes of the
message viewer do not change, and I see some inconsistent weirdness
with the display (some partial highlighting).
--dpb
On Thursday, March 13, 2003, at 06:56 AM, John Delacour wrote:
At 10:50 pm -0500 12/3/03, David P. Baker wrote:
Sorry, I don't understand. I'm not inside a "tell message viewer"
block....
I know what the problem is.
In Applescript in "all" applications
the first thing = the front thing = thing 1
But Mail's developers have have not learned this rule. In Mail, the
front message viewer (or message viewer 1), may be the front message
viewer as we humans conceive of it, or it may not.
So if you run this script you will see that the front message viewer
clearly has no messages displayed, but Mail will report the properties
of another message viewer instead.
tell app "System Events"
set visible of processes whose name is not "Mail" to false
end tell
tell app "Mail"
set s1 to "Result of:" & return
activate
(* start afresh *)
close windows
(* try to get Mail to understand its own dictionary *)
make message viewer with properties {selected mailboxes:{sent
mailbox}}
-- ONE LINE TILL -----
set s2 to "make message viewer with properties {selected
mailboxes:{sent mailbox}}"
------
display dialog s1 & s2 buttons "OK" default button 1
(* this doesn't work so close the window *)
close windows
set v1 to make message viewer
set selected mailboxes of v1 to {sent mailbox}
set v1's drawer is visible to true
set s2 to "set v1 to make message viewer
set selected mailboxes of v1 to {sent mailbox}
set v1's drawer is visible to true"
display dialog s1 & s2 buttons "OK" default button 1
(* Finally we have a result *)
make message viewer
set s2 to "make message viewer"
display dialog s1 & s2 buttons "OK" default button 1
(* which will obviously be the FRONT message viewer
and have no selected mailboxes *)
set MarchMadness to get selected mailboxes of the front message
viewer
(* But Mail reports properties of the back message viewer *)
tell me to activate
return {"Selected mailboxes of the front message viewer:
", MarchMadness}
--> {sent mailbox of application "Mail"}
end tell
_______________________________________________
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.