Need Script Help: Get Recipient Name

M

michael.hyatt

I need to get the name of the recipient to a message that is in my
inbox. This code produces and error. I was able to get the sender in a
similar way, but can't do it with the recipients. My guess is that that
is because the recipents are a collection. However, I am brand new to
AppleScript and can't figure out the syntax.

tell application "Microsoft Entourage"

set SelectedMessages to current messages

repeat with theMessage in SelectedMessages

set theRecips to to recipients of theMessage

-- This is just so I can view the variable:

display dialog dispRecips

end repeat

end tell
 
M

michael.hyatt

I think I figured it out. This code seems to work fine:

tell application "Microsoft Entourage"

-- Get the current message:
set SelectedMessages to current messages
set theMessage to item 1 of SelectedMessages

-- Get the name of the message recipient:
set theRecipients to every recipient of theMessage
set theRecipient to item 1 of theRecipients
set RecipientName to display name of the address of theRecipient

display dialog RecipientName

end tell

This only grabs the first name in the "To" field, but that is all I
need.
 
Top