On 6/22/02 07:13, greg wrote:
> Could someone tell me how to close a selected message's (in a message list)
> window (that's located behind the Mail browser) with AppleScript?
>
> Or rather I'm trying to move a selected list of messages to the trash and
> close their corresponding windows.
>
> Having only limited success only if the message is in the front :(
'Selected messages' and open message windows are not necessarily the same
thing.
This will first close, then delete, every window that's a message:
tell application "Microsoft Entourage"
set winlist to every window
repeat with thewin in winlist
if class of thewin is message window then
set themsg to displayed message of thewin
close thewin
delete themsg
end if
end repeat
end tell
This will delete selected messages in a message list, but won't attempt to
close the associated window if the message is open:
tell application "Microsoft Entourage"
set msglist to current messages
if msglist is not {} then
repeat with themsg in msglist
delete themsg
end repeat
end if
end tell
If you only want to delete messages that are both selected and open, then
you'd need to do something like this:
tell application "Microsoft Entourage"
set winlist to every window
set msglist to current messages
repeat with thewin in winlist
if class of thewin is message window then
set msgid to ID of displayed message of thewin
repeat with themsg in msglist
if ID of themsg is msgid then
close thewin
delete themsg
exit repeat
end if
end repeat
end if
end repeat
end tell
No doubt Paul or Allen will chime in with something that's much more
efficient <G>, but these should get you started.
George
--
George Clark - [EMAIL PROTECTED]
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>