The applescript shown below imports contacts from Contacts.app; it imports all the contacts all right except that if any string inside a contact is not in roman script (for instance, in greek ΣΥΧΩ) I get several question marks.
So the text must be ancoded. I searched a lot on the topic, and the only two snippet I thought could solve the issue are these: but trying each of the two I was not succesfull, i.e. the question marks remain. Maybe somebody may figure out how to deal with the problem.
At the bottom the two zipped files are available. By the way, if running the script the output file is empty, rename the applescript and it should work.
- set encoding to “utf16le”
- do shell script "textutil -convert txt -encoding UTF-8 " & quoted form of POSIX path of (myBackupName as text)
applescript begins:
set myBackupName to “AllContacts.vcf”
set myBackupPath to (path to desktop folder as string) & myBackupName
tell application “Contacts”
**set** myBackupFile **to** **open for access** *file* myBackupPath **with** write permission
**repeat** **with** aContact **in** *people*
**write** (vcard **of** aContact **as** *text*) to myBackupFile
**end** **repeat**
**close access** myBackupFile
end tell
tell application “Contacts” to quit
encodings.zip (1.5 KB) refers to the two lines above the script itself.
Contacts copy.scpt.zip (2.6 KB)
added greek specimen word