I would like to know what script I can use to add an email address of a person in Contacts to Mac Mail?
This is what I have thus far, it asks for various inputs and then uses these to compile a message. The rest of the code for the message works fine, but I would like the script to look for this person (based on the inputs), in Contacts and add the mail address listed there to the message in the To field:
--User Inputs to get Client details
display dialog "You are about to Create Outgoing e-mail for: Test
Please enter Client's First Name:" default answer "First Name"
set ClientName to text returned of result
display dialog "Please enter Client's Last Name:" default answer "Last Name"
set ClientLastName to text returned of result
--Create e-mail
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:true, subject:"Test", content:"Hi " & ClientName & ",
"}
tell theMessage
make new to recipient at end of to recipients with properties {address:ClientName & ClientLastName}
end tell
end tell
This creates the message and adds "ClientName + LastName" to To field, but I still have to go in and find the mail address. I would like Address Book to look up the person by First and Last Name and then add his address in the To field.