Title: Re: Shameless request for script
On 11/16/00 12:03 AM, "David Leitch" <[EMAIL PROTECTED]> wrote:


> Is there a script that will take a list of contacts that have category X and
> make a mailing group out of them, so that I can send an email to all
> contacts of category X?
>

If you have a lot of contacts, it’s slower than it should be because of a bug in Entourage's scripting (no ‘whose clauses’ for category). With my 200 contacts, it takes only a couple of seconds, however. If you have Akua Sweets scripting addition installed, the list of categories presented to you (to choose one) will be in alphabetical order; if not, not. You can sort the group (in E’s feeble sort by first name) afterwards. Or get my script Group. Sort E (in the Group Stuff E folder) to sort all your groups by last name. (You can get it at  <http://homepage.mac.com/berkowit28/ >)



-----------------CATEGORY GROUP E --------------------

tell application "Microsoft Entourage"
    
    
    set theCategories to (name of every category)
    try
        set theCategories to order list theCategories -- Akua Sweets
    end try
    
    choose from list theCategories with prompt "Which category should define the new group?"
    
    if result = false then
        error number -128
    else
        set catName to item 1 of result
    end if
    
    set theContacts to every contact
    
    set groupList to {}
    
    set num to (count theContacts)
    
    repeat with j from 1 to num
        
        set n to item j of theContacts
        
        set nCategories to get n's category
        try -- forget it if no email address
            if nCategories contains {category catName} then set end of groupList to ("\"" & n's name & "\" <" & n's default email address & ">")
        end try
    end repeat
    
    set theGroup to make new group with properties {name:catName, group entry:groupList}
    
end tell

--------------------------end script----------------------------------
--
Paul Berkowitz

Reply via email to