Title: Re: Simplifying and Clarifying
Thanks, Allen! I’m amazed that I just ask a question and you create an AppleScript.  Of course, now I need to learn how to use that. The learning continues.

I may wait until I get a few more Categories straightened out. Speaking of which, is there a way to select multiple Categories for one view? Right now I’m working on contacts who are on a small team that I coach. This small team is one of four in a group that I co-teach. And this group is the second one we’ve worked with in this company. So to get all the folks in the company I’ve got a category: Heidelberg. To get just the folks in the first group I’ve got a category: Heidelberg MDP 1. And to get just the folks in my team I’ve got a category: Heidelberg MDP 1 Team 3.

I assume that I need all 3 categories if I can’t select multiple categories to show the largest group. Is that right?

Thanks!

Walt


From: Allen Watson <[EMAIL PROTECTED]>
Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Date: Mon, 02 Jun 2003 18:07:50 -0700
To: Entourage mac Talk <[EMAIL PROTECTED]>
Subject: Re: Simplifying and Clarifying


On or near 6/2/2003 8:13 AM, Walt Hopkins at [EMAIL PROTECTED] observed:

> Many, many thanks to Jim, Allen, and Diane for your suggestions. Amazing to
> sit here in a tiny village in central Scotland and get advice from such
> helpful people somewhere out there!
>
> Christine (my assistant) and I have spent the morning working to add
> Categories to the address book. I already had lots of categories but they
> were not all attached.
>
> I checked on the Preferences and I did have all three checked to
> automatically connect categories and contacts and messages.
>
> We've run into two complications.
>
> When we add a category to a name and then create a rule, that does not seem
> to change the current situation with existing messages, even when I select
> the item and choose Apply Rule. Is there a way to do that?
>
> Lots of contacts have no recent messages showing, despite dozens of recent
> messages from them in the Inbox. Is there any way to connect these messages
> to the address book?
>
> That all worked so smoothly in CAT, the database I used for ten years before
> I finally moved to Microsoft.
>
Well, I'm not quite sure I understand both complications. For the first case, you don't say exactly what your rule checks for and what it does. I would assume that you want to get the messages categorized with the same category as their sender, right? And to have the messages linked to the contact. Unfortunately, that ONLY happens at the time you receive the messages; rules have nothing to do with that, it is done by Entourage automatically when the preferences are set that way.

The second problem sounds like the first problem...so I don't understand it at all if it is different.

To categorize and link _existing_ messages, ones you have received prior to setting those preferences, you will need to use an AppleScript. I'd been meaning to write this for myself anyhow!

The script below will look up the sender in your address book, get its category, assign the category to the message and link the message to the contact; if the sender isn't in your address book it will ask if you want to add them, and will have you choose a category. It processes only incoming messages; if outgoing messages are selected they will be ignored.

You can select multiple messages, then run the script.

In the event a contact has no category, it will pick your first category; so you should check, or perhaps you want to hard code the category name in the script (where you see "name of category 1" just put your category name, such as "Miscellaneous").

This should do it:

tell application "Microsoft Entourage"
    set theMsgs to current messages
    if theMsgs = {} then
        display dialog "No messages selected."
        return
    end if
    repeat with aMsg in theMsgs
        if class of aMsg is incoming message then
            set s to the address of the sender of aMsg
            try
                set theContact to find s
                set theContact to item 1 of theContact
                try
                    set theCat to item 1 of (get the category of theContact)
                    set theCat to name of theCat
                on error
                    set theCat to name of category 1
                end try
            on error theErr
                display dialog s & " is not in your address book. Do you wish to add them?" buttons {"No", "Yes"} default button 2
                if button returned of result is "Yes" then
                    try
                        get catNames
                    on error -- Just need to do this once
                        set catNames to name of every category
                    end try
                    set theCat to (choose from list catNames with prompt "Pick a category for the new contact.")
                    set theCat to item 1 of theCat
                    set dname to display name of the sender of aMsg
                    set wcount to (count words of dname)
                    set lname to word -1 of dname
                    set fname to text 1 thru (word (wcount - 1)) of dname
                    set theContact to make new contact with properties {first name:fname, last name:lname, address:s, category:category theCat}
                end if
            end try
            link aMsg to theContact
            set the category of aMsg to category theCat
        end if
    end repeat
end tell


Microsoft MVP for Entourage/OE/Word (MVPs are volunteers)
Allen Watson <[EMAIL PROTECTED]> Entourage FAQ site: <http://www.entourage.mvps.org/> <http://www.entourage.mvps.org/>
AppleScripts for Outlook Express and Entourage:
 <http://members.thinkaccess.net/[EMAIL PROTECTED]/Scripts/> <http://members.thinkaccess.net/[EMAIL PROTECTED]/Scripts/>  
Entourage Help Pages: <http://www.entourage.mvps.org/> <http://www.entourage.mvps.org/>


Reply via email to