Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Created April 22, 2009 18:40
Show Gist options
  • Save wizardishungry/99968 to your computer and use it in GitHub Desktop.
Save wizardishungry/99968 to your computer and use it in GitHub Desktop.
Exports all current address book contacts as individual VCards; suitable for storing in Git :)
tell application "Address Book"
tell application "Finder" to get folder of (path to me) as Unicode text
set PathName to result
--
set npersons to count of people
repeat with i from 1 to npersons
set vcardinfo to (vcard of person i) as text
set personName to (name of person i) as text
set target_file to PathName & personName & ".vcf" as text
try
set the open_target_file to ¬
open for access file target_file with write permission
set eof of the open_target_file to 0
write vcardinfo to the open_target_file starting at eof
close access the open_target_file
on error theErrMsg number theErrNumber
return theErrNumber & " " & personName
end try
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment