I've updated my multi-line address script to address both the home and
business address. I also changed the way it changes commas to returns, per
the recommendation of Paul Berkowitz, which should make it faster as well as
simpler. Thanks, Paul!

=====

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
                set sTemp to business address's street address
                set sTemp to my Fixup(sTemp)
                set business address's street address to sTemp
            end tell
        end if
    end repeat
end tell

to Fixup(s)
    if (count of s) = 0 then return "" -- don't bother if there's no string
to fix
    set sComma to (ASCII character 44) & " " as string
    set sQuote to (ASCII character 34) as string
    if text item 1 of s = sQuote then
        set str to text 2 through ((count of s) - 1) of s
    else
        set str to s as string
    end if
    set ods to AppleScript's text item delimiters -- normally the default
{""}
    set AppleScript's text item delimiters to {", "} -- what you want to
replace
    set ls to text items of str -- a list of the text items between
comma/spaces
    set AppleScript's text item delimiters to {return} -- new replacement
    set str to ls as string -- the magic new string
    set AppleScript's text item delimiters to ods -- must restore {""} or
you'll mess up every script you have
    return str
end Fixup

=====

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