[Pythonmac-SIG] just one apple event

Jack Jansen jack@oratrix.nl
Mon, 13 Dec 1999 12:42:42 +0100


> I don't think I stated my problem clearly. Once I build modules with 
> gensuitemodule.py I am able to make the call as I (more or less) 
> normally would. But I am left with several k of python code that I 
> don't necessarily need or want. Somewhere in the files created by 
> gensuitemodule.py Python sends the appleevent "misc, dosc, 
> "----":"workspace.foo", &tran:63464" to "LAND". That event is 
> identical to the one sent by the applescript one liner I can write to 
> do this job except for the &tran which is replaced with &subj:'null'()
> 
> For instance, in UserTalk (which bears a striking resemblance to 
> Python) there is the following call: appleevent("LAND", "misc", 
> "dosc", "----", "workspace.foo") which is pretty self explanatory.

The gensuitemodule stuff is all meant to isolate you from these low-level 
details. If you want to do the lowlevel stuff yourself (but be aware that 
you're also responsible for argument conversion and such) you can do it like 
this:

dummy, rv, dummy2 = aetools.Talker("LAND").send("misc", "dosc",
		{"----":"workspace.foo"})

rv will again be a dictionary mapping 4-char keys to return values. You may 
want to add the optional start=1 argument (to fire up the app if needed) to 
the Talker call.
--
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