Thanks, Roger
How often have you wanted to insert the E-mail address of a friend into the text of a message to someone else? I find myself doing that a lot. I also find it a pain in the butt to have to go to the Address Book, open the contact, copy the address, and then switch windows back to my message to paste it in. I have not figured out how to easily and quickly drag and drop; I guess if I could get both windows visible on my small screen, I might be able to locate the contact in the AB and just drag it? But I don't think so.
Anyhow, I wrote a script (big surprise, right?). It works great. Here it is:
Insert Contact's E-mail address (as text)--
by Allen Watson
<[EMAIL PROTECTED]>
Copies a contact's default mail address and inserts it into the current message. Assumes that the message is frontmost and editable.
set aName to text returned of (display dialog "Enter full name, or company, last name, first name, or nickname of the contact" default answer "" buttons {"OK"} default button 1)
set theChoice to ""
tell application "Microsoft Entourage"
try
get contact aName
set theChoice to aName -- Use the name
end try
if theChoice is "" then -- Did not find by full name
set someC to name of contacts whose name contains aName
if (count someC) = 0 then
display dialog "Contact \"" & aName & "\" not found."
return
else if (count someC) = 1 then
set theChoice to find (item 1 of someC)
else
set theChoice to choose from list someC with prompt "Which contact do you want to use?" without multiple selections allowed and empty selection allowed
set theChoice to item 1 of theChoice
end if
end if
if theChoice is "" then return
set theC to contact theChoice
try
set mailAddress to "<" & default email address of theC & ">"
on error
display dialog theChoice & " has no default E-mail address!"
return
end try
set the selection to mailAddress
end tell