Exporting the address book to a tab delimited file
Exporting the address book to a tab delimited file
- Subject: Exporting the address book to a tab delimited file
- From: Michelle Steiner <email@hidden>
- Date: Sun, 5 Jan 2003 17:40:03 -0700
After seeing the request for information about how to export the
address book to a tab-delimited text file, I decided that it was an
easy enough challenge for me to try to tackle. Here's the result.
Obviously, it needs a bit more work in the error-checking department
(test for duplicate file name, etc.).
set outfilename to choose file name
set outfile to open for access outfilename with write permission
tell application "Address Book"
repeat with thisPerson in the people
my writemyfile(outfile, name of thisPerson as text)
repeat with ThisAddress in email of thisPerson
my writemyfile(outfile, tab & value of ThisAddress)
end repeat
my writemyfile(outfile, return)
end repeat
end tell
close access outfile
on writemyfile(filetowrite, itemToWrite)
write the itemToWrite to the filetowrite
end writemyfile
I found that without the "as text" in the name of the person, it writes
to the file with what appears to be a space after each character in the
name. This does not happen with the email addresses, though. Both are
listed in the dictionary as being unicode text.
--Michelle
"There's some good in the world, Mr. Frodo, and it's worth fighting
for."
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.