Title: Re: Two new bugs in Entourage
On 10/22/00 5:30 PM, "Christian M. M. Brady" <[EMAIL PROTECTED]> wrote:

> On 10/22/00 7:19 PM, "David Cortright" <[EMAIL PROTECTED]> wrote:
>
>>>> I have a number of "nameless" contacts which have a company name, but no
>>>> individual is named.
>>
>>
>>
>> For my "company" contacts, I also put the company name in the Last Name
>> field as well. Makes for easier searching and sorting. Paul will probably
>> write a script within the next 24 hours that will see if the last name field
>> is empty and the company name is not, and do the work for you :-)
>
> I bet it will be within 2 hours!
>
Well, this one is too easy! This version will be quickest: if you have any contacts who have first names but not last names, they will be left alone even if they have a company. (e.g."Shirley" at "Square Plugs, Inc." will still be just "Shirley", not "Shirley Square Plugs, Inc."):


tell application "Microsoft Entourage"
    
    set theContacts to every contact whose name = ""
    repeat with theContact in theContacts
        set theComp to company of theContact
        set last name of theContact to theComp
    end repeat
    
end tell


 It could be adapted to include Department (you may have a number of contacts at the same company) like this:

tell application "Microsoft Entourage"
    
    set theContacts to every contact whose name = ""
    repeat with theContact in theContacts
        set {theComp, theDept} to theContact's {company, department}
        if theDept � "" then set theComp to theComp & " (" & theDept & ")"
        set last name of theContact to theComp
    end repeat
    
end tell


--
Paul Berkowitz

Reply via email to