> From: Nicholas Riley
>
> On Sat, Jan 18, 2003 at 01:37:46PM -0800, Kevin Altis wrote:
> > Is MetaKit still used for the AddressBook on Mac OS X? If so,
> what is the
> > location of the .mk database file? I would like to try
> inspecting the file
> > from the Python interpreter and also move the file over to a
> Windows machine
> > and try the same things.
>
> ~/Library/Application Support/AddressBook.data, but I tried opening
> 'em with Mk4py and had no luck.  (Also discovered another bug in Mk4py
> at the same time, which I'll fix soon since I'm working on it today
> anyway.)
>
> You should really be using the AddressBook APIs instead, and vCard for
> transport; they expose pretty much everything and are rather well
> designed.

Thanks!

If I was just using Mac OS X I would look at that API. Offlist, my friend,
Bill Bumgarner already suggested using the AddressBook APIs from PyObjC.
Bill said:

Assuming you have PyObjC installed... in any case, AddressBook stores
everything in vcard format.

Python 2.3a1 (#1, Jan 11 2003, 15:30:09)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import AddressBook
 >>> book = AddressBook.ABAddressBook.sharedAddressBook()
 >>> p = book.people()[0]
 >>> p.valueForProperty_('First')
'Bill'
 >>> p.valueForProperty_('HomePage')
'http://www.codefab.com/'
 >>>

However, in my case, I have no interest in doing something that only runs on
Mac OS X, thus my interest in accessing the data directly with metakit. I
transferred the file over to a Windows 2000 box and tried accessing the data
there and it seems to work.

>>> import metakit
>>> os.chdir(r'c:\tmp')
>>> db = metakit.storage('AddressBook.data', 0)
>>> db.description()
'ABDataType[UID:S,Property:S,_Property:I,Table:S,_Table:I,Type:I,_Type:I],_A
BDataType[_H:I,_R:I],ABInfo[UID:S,Me:S,_Me:I,Synced:I,_Synced:I,Version:I,_V
ersion:I],_ABInfo[_H:I,_R:I],ABGroup[UID:S,Creation:S,_Creation:I,Modificati
on:S,_Modification:I,GroupName:S,_GroupName:I],_ABGroup[_H:I,_R:I],ABMailRec
ent[UID:S,Last:S,_Last:I,PersonUID:S,_PersonUID:I,Email:S,_Email:I,First:S,_
First:I,MailLastDates:B,_MailLastDates:I],_ABMailRecent[_H:I,_R:I],ABGroupCo
ntents[UID:S,distribution:B,_distribution:I,MemberUID:S,_MemberUID:I,GroupUI
D:S,_GroupUID:I],_ABGroupContents[_H:I,_R:I],ABPerson[UID:S,Organization:S,_
Organization:I,AIMInstant:B,_AIMInstant:I,ICQInstant:B,_ICQInstant:I,MSNInst
ant:B,_MSNInstant:I,Email:B,_Email:I,HomePage:S,_HomePage:I,FirstPhonetic:S,
_FirstPhonetic:I,Middle:S,_Middle:I,MiddlePhonetic:S,_MiddlePhonetic:I,Last:
S,_Last:I,MaidenName:S,_MaidenName:I,LastPhonetic:S,_LastPhonetic:I,ABPerson
Flags:I,_ABPersonFlags:I,Phone:B,_Phone:I,Modification:S,_Modification:I,Yah
ooInstant:B,_YahooInstant:I,JobTitle:S,_JobTitle:I,Title:S,_Title:I,Address:
B,_Address:I,First:S,_First:I,Nickname:S,_Nickname:I,JabberInstant:B,_Jabber
Instant:I,Note:S,_Note:I,Suffix:S,_Suffix:I,StoredPictureName:S,_StoredPictu
reName:I,Creation:S,_Creation:I,Birthday:S,_Birthday:I],_ABPerson[_H:I,_R:I]
,ABLog[UID:S,DeletedUID:S,_DeletedUID:I],_ABLog[_H:I,_R:I]'
>>> vw = db.view('ABPerson')
>>> vw[0].First
'Kevin'
>>> vw[0].Last
'Altis'

I'll play some more, this looks promising.

ka
---
Kevin Altis
[EMAIL PROTECTED]
http://radio.weblogs.com/0102677/
http://www.pythoncard.org/

_______________________________________________
metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to