[Pythonmac-SIG] Calling python application from AppScript

David Person david at personconsulting.com
Tue Nov 15 04:45:28 CET 2005


Hello:

I'm sure there must be a simple answer, but I'm flummoxed trying to  
send an AppleEvent from one python program to another.

The 'server' program has this code:

class avServer(AEServer, MiniApplication):
   def __init__(self):
     MiniApplication.__init__(self)
     AEServer.__init__(self)
     self.installaehandler('aevt','oapp',self.openApp)
     self.installaehandler('aevt','quit',self.quit)
     self.installaehandler('ascr','psbr',self.processEvent)
     self.installaehandler('aevt','rapp',self.activate)
     self.installaehandler('****','****',self.other)


When I use this applescript, it works:

	tell application a
		set r to processEvent("system", "start")
	end tell


...but when I try from another python application I get an error:


from appscript import *
ap=app('pc-av')
ap.processEvent('system','start')

...or any number of other permutations. The most common error is  
"RuntimeError: Unknown property, element or command: 'processEvent'

Does anyone have any tips on how to do this? I'm writing both the  
client and server, so any method is fine. Get() and Set() will be  
fine if I could only get them to work...

Thanks for any help you can give,

-dp-
David


More information about the Pythonmac-SIG mailing list