Questo dovrebbe fare ciò che hai chiesto. Ti verrà chiesto di scegliere da un elenco se il nome utente che inserisci corrisponde a più di un contatto e anche se il contatto selezionato ha più di un indirizzo email tra cui scegliere.
set recipientList to {}
tell application "Mail"
activate
repeat
set userResponse to display dialog "who would you like to send the email to?" default answer "type address here" buttons {"Cancel", "Add another", "Done"}
if button returned of userResponse is "Done" then exit repeat
set the end of recipientList to my findContact(text returned of userResponse)
end repeat
set newMessage to make new outgoing message with properties {subject:"", content:"" & return & return}
tell newMessage
set visible to true
repeat with i from 1 to length of recipientList
make new to recipient at end of to recipients with properties {name:name of item i of recipientList, address:contactAddress of item i of recipientList}
end repeat
end tell
end tell
on findContact(userResponse)
set contactChoiceNames to {}
set pIDs to {}
tell application "Contacts"
set possibleContacts to every person whose name contains userResponse
repeat with l from 1 to length of possibleContacts
set the end of contactChoiceNames to name of item l of possibleContacts
set the end of pIDs to id of item l of possibleContacts
end repeat
end tell
activate --clarify which user you mean
set contactChoice to item 1 of (choose from list (contactChoiceNames))
tell application "Contacts"
repeat with nameIndex from 1 to length of contactChoiceNames
if contactChoice is item nameIndex of contactChoiceNames then
set contactData to item nameIndex of possibleContacts
exit repeat
end if
end repeat
set thisContactData to {name:name of contactData, contactAddress:(value of email of contactData)}
end tell
if length of contactAddress of thisContactData > 1 then --clarify which address you want to use
set addressChoice to item 1 of (choose from list (contactAddress of thisContactData))
else
set addressChoice to item 1 of contactAddress of thisContactData
end if
set contactAddress of thisContactData to addressChoice
return thisContactData
end findContact