> If I know who the sender of a message is in an AppleScript
>
> "set theAddress to the sender of theMsg"
>
> How would I go about setting theAddress to only characters 2 through
the
> last character of the sender?
>
> Ie. The from might be "[EMAIL PROTECTED]" but I want the AppleScript to
> send the automatic reply to "[EMAIL PROTECTED]".
>
If you look in the AppleScript Dictionary for Entourage, you'll see that
'sender' is of the class 'address', and if you look up 'address', you see it's
actually a record with two parts: display name (like "Joe Bloggs", or "" if
there isn't any) and address (again!, but this time it's a string - whatb you
were expecting - like "[EMAIL PROTECTED]". So the bit you want to modify
is actually not 'sender of theMsg', but 'address of sender of theMsg':
set senderAddress to address of the sender of theMsg
set senderAddress to text 2 thru -1 of senderAddress
To send and auto-reply without worrying about the display name, you'd
set replyMsg to make new outgoing message at drafts folder with
properties {subject:theSubject, content:replyContent,
recipient:senderAddress} -- all one line
send replyMsg
(You can set the account too, etc.) But it's nicer to use Joe Blogg's name
as well:
set dispName to display name of sender of theMsg
if dispName /= "" then
set theContent to "Dear " & dispName & "," & return & return &
theContent ---all one line
set theRecipient to "\"" & dispName & "\" <" & senderAddress & ">"
else
set theRecipient to senderAddress
end if
set replyMsg to make new outgoing message at drafts folder with
properties {subject:theSubject, content:replyContent,
recipient:theRecipient} -- all one line
send replyMsg
--------------------
Watch out for email-imposed carriage returns in long lines -- remove
them, I'm writing this from webmail and can't send HTML.
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
To search the archives:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>