[Pythonmac-SIG] Python vs. AppleEvents

Jack Jansen jack@oratrix.nl
Wed, 18 Aug 1999 14:21:26 +0200


> I followed the example in Mac:Demo:applescript.html and used
> gensuitemodule to create an Now Contact specific module. I managed to do
> simple data access calls (e.g. get some
> entry's name) but I haven't figured out how to do more interesting
> things, e.g. count the
> entries and loop over them. How about the existings suites like
> Standard_Suite and
> AppleScript_Suite?

Some of the basic stuff you need to do this is available (see aetools.py, 
aetypes.py and aepack.py in Mac:Lib:lib-toolbox) but I never got around to 
getting the overall design done.

What I'd really like, in case you're interested in giving it a try, is if you 
could do something like:
    for objspec in app.contact['all']:
	print "First name:" objspec.NameInfo.first_name.get()

The idea begin that app.contact['all'] returns a list of object specifiers 
(the 'all' should probably be done differently, though), and object specifiers 
have a magic __getattr__ that'll return object specifiers for its elements and 
properties.

The ComponentItem and such in aetypes.py are about as far as I got (which 
isn't very far). The most difficult part, I think, is to get a nice design 
done, the example I give above already has flaws and I don't know how to iron 
them out. Once the design is ready the implementation shouldn't be too much 
work, as it is mainly glue: the lowlevel interface is (AFAIK) complete.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm