Address Book AppleScript example

Here’s a simple AppleScript that exports all of the email addresses in your Mac OS X address book as a comma-separated list:

tell application “Address Book”

set emailList to {}

set peopleCount to (count every person)

repeat with i from 1 to peopleCount

set emailList to emailList & (get value of every email of person i)

end repeat

set outputFileName to choose file name with prompt “Save address book as text:” default name “addressbook.txt”

set outputFile to open for access outputFileName with write permission

repeat with e in emailList

write e & “, ” to outputFile

end repeat

close access outputFile

end tell

One Response to “Address Book AppleScript example”

  1. Cool Says:

    Thanks, not much on the web about scripting address book

Leave a Reply