don't use the formatted address approach if it's causing you headaches. If you look at the address book applescript dictionary, you'll see that you can extract the pieces of the address individually and combine them as you like. play with it a bit (that's what applescript is for) and you'll get the hang of it.
set CSZ to theCity & ", " & theState & " " & theZip
activate application "TextEdit"
tell application "System Events"
key code 36
and got city-state-zip correct:
Kansas City, KS 66160
But the remaining bug is for multi-line street addresses, it's not implementing the carriage return, even though the Address Book script library says "Street part of the address, multiple lines separated by carriage returns."
so I'm getting:
University of Kansas Medical CenterDepartment of Neurology3901 Rainbow Blvd.
when I of course want:
University of Kansas Medical Center
Department of Neurology
3901 Rainbow Blvd.
yeeee... first, don't use system events for simple text processing - you'll give yourself a mental hernia. just say this:
set theAddressString to theName & return & theStreet & return & CSZ
tell application "TextEdit"
set text of document 1 to theAddressString
The 'return' bits will give you the proper effect. with respect to the other problem, it may be a confusion about line ending characters. Mac style is to use a carriage return, unix style is to use a linefeed, Windows style uses a carriage return followd by a linefeed. if you've imported your address book entries from a different machine they may have odd line ending codes built in which you'd have to test for. hard to test for that from this side of the internet, though.