Title: Re: How to Sync Fields that are in the Entourage Address Book that are not on the Palm
Paul BerkowitzPeter Wait

Here is my attempted AppleScript to move several items to the “Notes”, following the suggestions at the bottom below:

tell application "Microsoft Entourage"
    set selc to every contact whose (birthday � "" or nickname � "" or anniversary � "")
    repeat with i from 1 to (count my selc)
        set c to item i of my selc
       tell c
           if its nickname � "" then
               set its description to ("Nickname: " & (get its nickname) & return)
            end if
           if its birthday � "" then
               set its description to ("Birthday: " & (get its birthday) & " [" & (get its age) & "]" & return)
            end if
           if its anniversary � "" then
               set its description to ("Anniversary: " & (get its anniversary) & return)
            end if
       end tell
   end repeat
end
tell

But I’m afraid running it could mess up my address book. What folder contains the Entourage addresses, so I can save it elsewhere, and then restore it if need be? Also, if there are any glaring errors, I’d appreciate the feedback.

On 7/25/02 5:25 PM, "Allen Watson" <[EMAIL PROTECTED]> wrote:

On or near 7/25/2002 4:55 PM, Peter Wait at [EMAIL PROTECTED] observed:

>
> I’m going to start with Birthday. My first attempt follows:
>
> tell application "Microsoft Entourage"
>   set nbbd to every contact whose birthday � ""
>   repeat with i from 1 to (count nbbd)
>       set c to item i of nbbd
>       tell c to set its note to (get its birthday)
>   end repeat
> end tell
>
> But how do I specify, to put the birthday in the note after any lines that
> are already there, if any are; and not to just overlay the existing note?
>
Like this:

tell application "Microsoft Entourage"
    set nbbd to every contact whose birthday � ""
    repeat with i from 1 to (count nbbd)
        set c to item i of nbbd
        set temp to c’s note
       tell c to set its note to (temp & return & (get its birthday))
    end repeat
end
tell

Actually, the AppleScript term for a contact note is not note, it's 'description'. The two scripts above will compile since 'note' is an Entourage term for the Note object, (actually, they'd compile anyway since 'note' is also an AppleScript term for something completely different, but it won't do what you want. you have to use the Entourage dictionary, peter, not guess at what it might be called. Under 'Contact' class, you'll see 'description' as a property. No 'note' there.)

And how will you know that this is going to be the birthday and not the anniversary, or something else? I suggested last time you prefix a label. Like this:

tell application "Microsoft Entourage"
    set nbbd to every contact whose birthday � ""
    repeat with i from 1 to (count my nbbd)
        set c to item i of my nbbd
       tell c
           set theNotes to description
           set its description to (theNotes & return & "Birthday: " & (get its birthday))
        end tell
   end repeat
end
tell


If you're going to get more properties, only get the description once and set it to a variable as Allen showed you. then swing through all the properties you want adding another line where the value isn't "", just as you do above. By putting it in a 'tell c' block, you don't have to keep referring to c's this and c's that, but you can do it that way instead if you prefer. But you'll have to make your list every contact, not just those that have a particular property or other; whatever you do, don't reset the list for each property. It will also go _much faster for large lists if you refer to 'my nbbd' after defining it.



Reply via email to