[Pythonmac-SIG] applescript to python examples for Address Book?

Kevin Altis altis at semi-retired.com
Sat Aug 7 19:46:47 CEST 2004


This message should probably go to the PyObjC mailing list, but perhaps  
someone will have the answer here. I want to be able to get a list of  
names and email addresses from the Address Book using Python. I have  
found the Address Book module for PyObjC, but the API doesn't make much  
sense to me. Delving into the Apple Developer docs didn't help much  
either.

http://developer.apple.com/documentation/UserExperience/Reference/ 
AddressBook/ObjC_classic/Classes/ABPerson.html#//apple_ref/occ/cl/ 
ABPerson

I'm hoping someone has a script example using PyObjC or aeve or  
whatever else is available that is basically the equivalent of the  
first part of the script from Panther Hacks.

http://www.macdevcenter.com/pub/a/mac/excerpt/pantherhacks/

-- open Address Book and loop through people

tell application "Address Book"
   repeat with thisPerson in the people
     set thisName to name of thisPerson
     repeat with thisAddress in email of thisPerson
       set thisEmail to value of thisAddress
...

Apologies if Python examples are lying around somewhere. I couldn't  
find anything in my pythonmac-sig list archive, wiki, etc. I want to  
grab the info and present it to the user as part of a wxPython app.

ka
---
Kevin Altis
altis at semi-retired.com
http://altis.pycs.net/



More information about the Pythonmac-SIG mailing list