Re: Untitled window in Outlook Express
Re: Untitled window in Outlook Express
- Subject: Re: Untitled window in Outlook Express
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 26 Oct 2002 08:10:57 -0700
On 10/26/02 6:12 AM, "John Clark" <email@hidden> wrote:
>
The script below is part of an applet
>
tell application "Outlook Express"
>
activate
>
set w to make new draft window with properties {to recipients:e_mail,
>
subject:msgSub, attachment:tellspot}
>
send w with sending later
>
end tell
>
>
When running I got an error "Outlook Express can't get window "Untitled""
>
>
I then added an if statement
>
>
tell application "Outlook Express"
>
activate
>
set w to make new draft window with properties {to recipients:e_mail,
>
subject:msgSub, attachment:tellspot}
>
if name of window 1 is equal to "Untitled" then
>
set name of window 1 to msgSub
>
set w to window 1
>
end if
>
send w with sending later
>
end tell
>
>
When run as a script it works fine but when run as an applet I still get the
>
error message.
>
>
Any ideas
Sounds like your computer is "too fast". I've never tried to send a draft
window that had no content before - possibly the lack of content makes the
window draw so quickly, but more likely it's just too fast.
The main point is: why are making a draft window on the screen if you are
sending the message to the outbox immediately? There's no reason for a draft
window on the screen if you aren't using it manually there. Make an outgoing
message instead. You don't explain what your variables represent, but if
'e_mail' is a single recipient, then just do it this way. You also won't
even need to activate OE - you can let this happen in the background if it's
running from a schedule, for example. (Otherwise, it's already activated
anyhow.) Also there will be no need to 'send with sending later' if you make
the outgoing message in the Outbox.
tell application "Outlook Express"
make new outgoing message at out box folder with properties
{subject:msgSub, recipient:e_mail, attachment:tellspot}
end tell
If 'e_mail' can ever represent more than one recipient, then you need to set
it up as a list, not a comma-delimited string like your 'to recipients' for
draft window, in this format:
{{display name:"Joe Blow", address:"email@hidden"}, {display name:"Mary K.
Smith", address:"email@hidden"}}
or
{"Joe Blow <email@hidden>", "Mary K. Smith <email@hidden>"}
or simply:
{"email@hidden", "email@hidden"}
if you're not concerned about the display name.
Which you can do by starting out with
set e_mail to {}
and then
set end of e_mail to "email@hidden"
set end of e_mail to "email@hidden"
in a repeat loop.
[If you wanted CC or BCC recipients, it gets more complicated: see the
dictionary for 'recipient'.]
The message will stay in the Outbox until send-all.
--
Paul Berkowitz
_______________________________________________
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.