Skip to content

Instantly share code, notes, and snippets.

@freklov
Created October 29, 2017 06:57
Show Gist options
  • Save freklov/a163eab884e932f1022bb50c37ccf15a to your computer and use it in GitHub Desktop.
Save freklov/a163eab884e932f1022bb50c37ccf15a to your computer and use it in GitHub Desktop.
AppleScript for Apple Contacts: Export all contacts as individual vCards
-- requires a folder "vCards" on the user desktop
--
set desktopPath to (path to the desktop folder as string) & "vCards"
alias desktopPath
tell application "Contacts"
repeat with cardPerson in people
set nameOfvCard to name of cardPerson & ".vcf"
set outFile to (open for access file (desktopPath & ":" & nameOfvCard) with write permission)
write (vcard of cardPerson as text) to outFile
close access outFile
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment