In article <C8DCC28D.2B7B7%ja...@ja...>,
Jeremy Reichman <ja...@ja...> 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,
na...@ac...
|