Re: Obtain data from an Address Book card
Ned Deily <[email protected]>
| Newsgroups | gmane.comp.python.pyobjc.devel |
|---|---|
| Message-ID | <[email protected]> |
In article <C8DCC28D.2B7B7%[email protected]>, Jeremy Reichman <[email protected]> wrote: > Does anyone have any examples of how to obtain data from cards via the > Address Book API with PyObjC? I'm not finding much (at least at my skill > level) via searching. > > My goal is to output a few of the fields from "my card." I'm interested in > this from the scripting perspective, not doing so in a full-fledged app. I'd > like to do it with Python, partly as a learning exercise. The little bit > I've done with PyObjC has been trying to update a script I wrote that used > the old Core Graphics bindings. > > If I were doing this via a shell script, I could get information with an > osascript line like this: > > $ osascript -e 'tell application "Address Book" to get the {first name, last > name, organization} of my card' > Leonardo, Flathead, GUE Tech You might consider using py-appscript instead: >>> from appscript import * >>> my_card = app("Address Book").my_card.properties() >>> [my_card.get(f) for f in (k.first_name, k.last_name, k.organization)] [u'Ned', u'Deily', k.missing_value] http://appscript.sourceforge.net/ -- Ned Deily, [email protected] ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev