applescript for address book
MacBook Pro, Mac OS X (10.5.8)
MacBook Pro, Mac OS X (10.5.8)
tell application "Address Book"
set theContacts to the selection
set theText to ""
repeat with thisPerson in theContacts
set theText to theText & name of thisPerson & return
try
set theText to theText & formatted address of first address of thisPerson & return
end try
set theText to theText & return
end repeat
end tell
tell application "TextEdit"
set theNewDoc to make new document
set text of theNewDoc to theText
print theNewDoc
end tell
tell application "Address Book"
set theContacts to the selection
repeat with thisPerson in theContacts
set theStreet to the street of first address of thisPerson
end repeat
set theStreet1 to the character 1 of theStreet
set theStreet2 to character 2 of theStreet
set theStreet3 to character 3 of theStreet
set theStreet4 to character 4 of theStreet
set theStreet5 to character 5 of theStreet
set theStreet6 to character 6 of theStreet
set theStreet7 to character 7 of theStreet
set theStreet8 to character 8 of theStreet
set theStreet9 to character 9 of theStreet
set theStreet10 to character 10 of theStreet
set theStreet to "1: " & theStreet1 & return & "2: " & theStreet2 & return & "3: " & theStreet3 & return & "4: " & theStreet4 & return & "5: " & theStreet5 & return & "6: " & theStreet6 & return & "7: " & theStreet7 & return & "8: " & theStreet8 & return & "9: " & theStreet9 & return & "10: " & theStreet10 & return
end tell
tell application "TextEdit"
set theNewDoc to make new document
set text of theNewDoc to theStreet
end tell
1: 1
2: 2
3:
4: 1
5: s
6: t
7:
8: a
9: p
10: t
set theStreetArray to paragraphs of (get street of first address of thisPerson) that will work, and it won't fail if you have street addresses that are more than three lines. but that's a minor thing, really. glad you have something you can use.applescript for address book