Skip to content

Instantly share code, notes, and snippets.

@echoz
Created December 3, 2011 11:08
Show Gist options
  • Save echoz/1426879 to your computer and use it in GitHub Desktop.
Save echoz/1426879 to your computer and use it in GitHub Desktop.
Add groups that a contact belongs to the company field as CSVs
tell application "Address Book"
set prefix to ", "
repeat with p in (get people)
set gs to ""
repeat with g in (get p's groups)
if (gs = "") then
set gs to g's name
else
set gs to gs & prefix & g's name
end if
end repeat
if (p's organization = missing value) then
set p's organization to gs
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment