On 28/6/06 20:19, "revDAVE" <[EMAIL PROTECTED]> wrote:

> Applescript help
> 
> My goal is to get the name and email address of the recipients ('to' field)
> of an email.... Now it just gets the name without the email address
> 
> Q: how can I get the email address too?
> 
> 
> This line works....
> 
>     set whoto to name of address of (recipients of theMessage whose
> recipient type is to recipient)
> 
> But this line fails ...
> 
>     set whotoemail to email of address of (recipients of theMessage whose
> recipient type is to recipient)
>     
> 
> --
> Thanks - RevDave
> [EMAIL PROTECTED]
> [db-lists]
> 
> 

You are on the right lines.

If you examine the applescript dictionary of Entourage, you will get the
clues you need.

"address of (recipients of theMessage whose recipient type is to recipient)"
is exactly the right place to start. Looking at the dictionary entry for a
message, you can see that it has an element called "recipient". This is what
you get with your line above. The class definition (again, in the
dictionary) for a recipient shows it has two properties: Address and
Recipient type. You used 'recipient type' to get the list of addresses of
the 'to recipients'.

Now, when your script line gets the 'address of recipient' what it gets is
defined (in the recipient dictionary entry) as a data type of class
'address'. Dig a bit deeper in the dictionary and you see that, in turn, a
data class of address contains two more properties: 'address' and 'display
name'. The first of these is defined as a string, the latter as Unicode
Text.

So, what contains the actual email address is:

Address of address of (recipients of theMessage whose recipient type is to
recipient)

Now, put it all together....

If you want both the display name and the email address of the recipients,
do it with this:

tell application "Microsoft Entourage"
    set theMessage to item 1 of (get current messages)
    set {whoto, theName} to {address, display name} of address of ¬
        (recipients of theMessage whose recipient type is to recipient)
end tell

This will give you two lists: theName contains a list of the display names
of all the to recipients, whoto contains a list of all the email addresses.
-- 
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Check out the Entourage User's WebLog for hints, tips and troubleshooting
<http://homepage.mac.com/barryw/weblog/weblog.html>




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