Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Address Book API and the CLI

Address Book API and the CLI
Thread Tools
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Nov 25, 2002, 10:25 PM
 
All I want at this moment is a command line utility which can export all the information from the Address Book. With the new Address Book API, this can't be terribly difficult but I don't know where to start. I don't know how to make command line utilities beyond shell scripts.

How much would would this require? I've seen a few Cocoa apps which export data, but neither of them do it entirely.

In the end I hope make a PHP script which will parse the outputted file and display it's contents on a web page. (The HTML exporter isn't what I'm looking for, I want to do it myself and I want it dynamic so it's always updated)
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Nov 26, 2002, 09:30 AM
 
Originally posted by Xeo:
All I want at this moment is a command line utility which can export all the information from the Address Book. With the new Address Book API, this can't be terribly difficult but I don't know where to start. I don't know how to make command line utilities beyond shell scripts.
Instead of using the API, have you looked at the AddressBook file itself? Can you not open it directly?

Of course, we're not sure if that format will stay the same forever. But it's a start, anyway.
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Nov 26, 2002, 10:23 AM
 
http://www.cocoadev.com/index.pl?AddressBook

you can make a foundation tool (Command-line app) with the address book framework - since it does not need AppKit.
     
Junior Member
Join Date: Aug 2002
Location: Northeastern NV, USA
Status: Offline
Reply With Quote
Nov 26, 2002, 10:55 AM
 
Go grab a copy of O'Reilly's latest book, "Learning Cocoa with Objective C". They actually have a sample program in it that will show you how to write a simple command line (foundation tool) that uses the Address Book (AB) classes. It's a simple example but you should be able to easily expand upon it using all of the other examples in that chapter, including dumping the contents out to a file. This book has some great examples of simple Foundation Tool apps that demonstrate all sorts of string handling techniques.

BTW: Make sure you get the correct version of this book. This is the NEW version (2nd) I'm talking about. The first version of Learning Cocoa wasn't much more than a rag-tag collection of tutorials downloaded from Apple's site and put into paperback form. The 2nd version of this book (that has Objective-C in the front page title) is an actual teaching guide that walks a beginner through the process of learning to program in Objective C, using the debugger withing Project Builder, and creating MAC OS X applications using the Cocoa Framework. It's really really good book.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Nov 26, 2002, 11:31 AM
 
     
Xeo  (op)
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Nov 26, 2002, 05:00 PM
 
Wow, those last 3 posts have to be the most helpful I've ever seen. Thank you all.

Diggory, that's perfect. I couldn't find the AddressBook API and now I have it.

Angus, that program doesn't do what I want (although I could parse the VCARD, I don't really want to; I'm having too much fun with parsing iCals at the moment ) However, it comes as source and I can edit it right there. It's a great foundation for building what I want. Thanks.

yeslekmc, I was looking for a good Cocoa book. It sounds like the new O'Reilly is really good. I think it's time I bought myself one.

To answer hayesk, no, I can't open the file directly. It's not stored in plain text. I need to use the API so I can extract the info. Thanks anyway.
     
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 1, 2003, 08:53 AM
 
Hey, how did your work come out, I'm writing the same thign in which I will parse out teh address book data and put it into a php or perl page. Any tips before I start?
Thanks

Originally posted by Xeo:
Wow, those last 3 posts have to be the most helpful I've ever seen. Thank you all.

Diggory, that's perfect. I couldn't find the AddressBook API and now I have it.

Angus, that program doesn't do what I want (although I could parse the VCARD, I don't really want to; I'm having too much fun with parsing iCals at the moment ) However, it comes as source and I can edit it right there. It's a great foundation for building what I want. Thanks.

yeslekmc, I was looking for a good Cocoa book. It sounds like the new O'Reilly is really good. I think it's time I bought myself one.

To answer hayesk, no, I can't open the file directly. It's not stored in plain text. I need to use the API so I can extract the info. Thanks anyway.
     
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 3, 2003, 07:28 AM
 
This link is down, anyone know where I can get the files that used to be there?

Originally posted by Diggory Laycock:
http://www.cocoadev.com/index.pl?AddressBook

you can make a foundation tool (Command-line app) with the address book framework - since it does not need AppKit.
     
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Apr 7, 2003, 06:19 PM
 
Hi, I was just wondering if anyone had some simple source code that plays with the address book that I could look at, thanks.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2