Here is my first attempt at an Entourage AppleScript. It looks at home
addresses in selected contacts and removes straight quotes from the
beginning and end. Then it replaces all commas (followed by a space) with
returns. This became necessary after I imported 1200 contacts that were
exported from Excel as tab-delimited text.

tell application "Microsoft Entourage"
    set theItems to selection
    repeat with i in the theItems
        if class of i is contact then
            set theContact to i
            tell theContact
                set sTemp to home address's street address
                set sTemp to my Fixup(sTemp)
                set home address's street address to sTemp
            end tell
        end if
    end repeat
end tell

to Fixup(s)
    set ss to s as string
    set sComma to (ASCII character 44) & " " as string
    set sQuote to (ASCII character 34) as string
    if (offset of sQuote in s) = 1 then
        set ss to text 2 through ((count of s) - 1) of s
    end if
    repeat while (offset of sComma in ss) > 0
        set iOffset to (offset of sComma in ss)
        set sStart to text 1 through (iOffset - 1) of ss
        if (count of ss) > (iOffset + 1) then
            set sEnd to text (iOffset + 2) through (count of ss) of ss
        else
            set sEnd to ""
        end if
        set ss to sStart & return & sEnd
    end repeat
 return ss
end Fixup


There are undoubtedly dumb things I�ve done here, so if you have any
comments I�d love to hear them. Later, I'll update this to do both the home
and work address.

Thanks,

Rick Johnson


--
To unsubscribe:               <mailto:[EMAIL PROTECTED]>
To search the archives:
          <http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to