On 5/20/02 12:58 PM, "Allen Watson" <[EMAIL PROTECTED]> wrote:

> Okay, the thing is a draft window that hasn't been saved does not have a
> message ID yet. So "current messages" returns the empty set. You have to
> force the window to be saved first, like this:
> 
> if class of the front window is draft window then
>   try
>       save the front window
>   end try
> end if
> 
> Put that code right before the line, "set theMsg to item 1 of (get current
> messages)". 
> 
>> 

No need to try. But you won't get the correct message that way, Allen. If
there was a message was selected in the folder previously, that one  is
still selected. And if there was none, it's still {}.
 I think what you want is this:

Okay, the thing is a draft window that hasn't been saved does not have a
message ID yet. So "current messages" returns the empty set. You have to
force the window to be saved first, like this:

 if class of the front window is draft window then
        set theWindow to the front window
        save theWindow
        set theMsg to displayed message of theWindow
else
    set theMsg to item 1 of (get current messages)
 end if


That will get you the message you're working on, whether it's a new message,
a saved (draft?)message in its own window, or a saved message in the Preview
Pane. (I don't know if you even need all those options or just the upper bit
for new messages. Why do you need to bother with saved messages in the
review Pane? Shouldn't this actually be the cosde:

 if class of the front window is draft window then
        set theWindow to the front window
        save theWindow
        set theMsg to displayed message of theWindow
else
    beep
    display dialog "This script only works with new and draft messages."
buttons {"OK"} default button 1 with icon 0
    return
end if
    
This will work with brand new messages and with saved drafts which you've
opened up to edit.

Then change the account as before. And Barry is right on about 'offset'.I
_never_, ever,  use offset. It's far too wonky and unpredictable.

> 


-- 
Paul Berkowitz


-- 
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/>

Reply via email to