• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Exporting the address book to a tab delimited file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Moving files from desktop to User folders
  • Next by Date: saving a file in GraphicConverter
  • Previous by thread: Re: do shell of file on CD-ROM
  • Next by thread: saving a file in GraphicConverter
  • Index(es):
    • Date
    • Thread