Re: Script used in conjunction with OE Rule
Re: Script used in conjunction with OE Rule
- Subject: Re: Script used in conjunction with OE Rule
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 21 Sep 2002 17:27:48 -0700
On 9/21/02 4:50 PM, "Ray Barber" <email@hidden> wrote:
>
Hi all ...
>
>
I'm running into trouble creating a script for a rule in OE 4.5, which I'd
>
like to associate it to. Essentially, this script will be run from a Rule,
>
based on a email I have received.
>
>
There are two issues I've had trouble with.
>
>
a) When I test using the Script Menu under Outlook Express, I can't seem to
>
get it to fill in the recipient prior to sending the message. It creates
>
the message fine, only without a recipient.
>
>
I found it interesting that I could initially use "make draft window with
>
properties", but falls short when I tried to accommodate sender.
>
>
and b), I cannot seem to get it to set the acct I wish to use. Is there a
>
way I can set an acct prior to sending, regardless the acct the email was
>
sent to?
>
>
I have tried various things (by purviewing OE's dictionary), but
>
unfortunately have come up with zilch. Below is a sampling, left unchanged
>
from last state.
>
>
======================================================================
>
>
set popAccountNames to "myacctnamegoeshere"
>
set reportTo to "email@hidden"
>
>
tell application "Outlook Express"
>
set selectedMessages to the current messages
>
repeat with theMessage in the selectedMessages
>
set theSubject to subject of theMessage
>
set theBody to source of theMessage
>
make new outgoing message with properties [NOT('SIDEWAYS-L')]
>
{to recipients:reportTo, subject:"Fwd: " & theSubject,
>
[NO-BREAK]content:theBody}
>
send
>
set read status of theMessage to read
>
end repeat
>
end tell
>
>
======================================================================
>
>
What am I doing wrong here? A gentle prodding will do, or a re-write will be
>
greatly appreciated. >:)
You haven't actually studied the Dictionary. There is no property of
'outgoing message' called 'to recipients', as there is for draft window.
There is only 'recipient', which is a record with numerous properties,
including 'recipient type'. In OE5 there is a ice undocumented shortcut that
does allow you to send to one to recipient (the default recipient type) by
simply doing
make new outgoing message with properties {recipient:reportTo,
subject:"Fwd: " & theSubject, content:theBody}
That is, if 'reportTo' is a single [name and] email address such as:
set reportTo to "email@hidden"
or
set reportTo to "Ray Barber <email@hidden>"
or, best of all
set reportTo to "\"Ray Barber\" <email@hidden>"
(which you absolutely need if there's any punctuation in the display name),
it will work just like that. I can't recall (it's been almost 4 years since
I used OE 4.5) if that works in 4.5 or only in .
According to the Dictionary, this is the correct syntax, which will work
under all circumstances and versions:
make new outgoing message with properties
{recipient:{address:{address:reportTo}, recipient type:to recipient},
subject:"Fwd: " & theSubject, content:theBody}
i.e.
make new outgoing message with properties
{recipient:{address:{address:"email@hidden"}, recipient
type:to recipient}, subject:"Fwd: " & theSubject, content:theBody}
or
make new outgoing message with properties
{recipient:{address:{address:"email@hidden", display
name:"Ray Barber"}, recipient type:to recipient}, subject:"Fwd: " &
theSubject, content:theBody}
Actually, you can omit 'recipient type:to recipient' because it's the
default, but you need this syntax for cc and bcc recipients, and then would
also need to include 'to recipient' type for to recipients.
This convoluted syntax was required by the Apple Mail Suite. That's why OE
(5?) also has the simpler, undocumented version.
You can figure out the long syntax by seeing that 'outgoing message' and
'incoming message' both have 'recipient as elements, not a property - so you
can include several of them. And 'recipient' is a class in the dictionary
with several properties including 'address' and 'recipient type'. 'address'
in turn (this one is the killer, and rather idiotic) is a class with two
properties ; 'address' again (!!!), which this time is a string, and
'display name', also a string. So you can piece it all together.
Or just the easy way, if it's available in 4.5.
--
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.