I'm trying to read Apple AddressBook stuff and while it works on my
system, on one of my users, I get a NilObject. I don't want to write,
just read.
Since I've never actually used Apples AddressBook myself I'm at
somewhat of a disadvantage. The code is pieced together from what I
read about and guessed at to make work on my own OS X system.
It's also kind of confusing as to which fields in the addressbook's
have counts attached to them and which ones don't.
addressData() is a bunch of text fields in the current window, I am
filling them with data from the address book.
Suggestions welcome.
Dim i, j, k, m as Integer
Dim book as AddressBook
Dim address As AddressBookAddress
Dim data As AddressBookData
Dim Contacts() as AddressBookContact
'
book=System.AddressBook
Contacts=book.Contacts
'
For i =0 to Ubound(Contacts)' loop through the whole address book
addressData(0).Text=Contacts(i).FirstName
addressData(1).Text=Contacts(i).LastName
addressData(2).Text=Contacts(i).CompanyName
'
data=Contacts(i).Addresses
address=data.Value(0)'
addressData(3).Text=address.StreetAddress
addressData(4).Text=address.City
addressData(5).Text=address.State
addressData(6).Text=address.Zip
addressData(7).Text=address.Country
'
j=Contacts(i).PhoneNumbers.Count
If j>3 Then' I only want the first two
j=3
End If
If j>0 Then
For k=0 to j-1
addressData(8+k).Text=Contacts(i).PhoneNumbers.Value(k)
Next
End If
'
j=Contacts(i).EmailAddresses.Count
If j>2 Then
j=2
End If
For k=0 to j-1
addressData(12+k).Text=Contacts(i).EmailAddresses.Value(k)
Next
'
addressData(14).Text=Contacts(i).Homepage
addressData(15).Text=Contacts(i).Note
Next
'
Mel
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|