[Pythonmac-SIG] Making a Python application scriptable via AppleScript

has hengist.podd at virgin.net
Sun Aug 9 15:30:38 CEST 2009


Kevin Walzer wrote:

> What options currently exist for making a Python application on the  
> Mac scriptable via AppleScript, i.e. allowing it to respond to Apple  
> events and making Python data objects and functions accessible from  
> AppleScript?
>
> I'm aware of AppScript, but as I understand it, this module is  
> designed more to allow Python apps to drive *other* AppleScriptable  
> apps via the OSA. I'm interested in the opposite. I understand that  
> there used to be some modules to support this, but they appear to be  
> deprecated.


If it's a PyObjC-based app then use Cocoa Scripting. It has some  
issues but will still be quicker than rolling your own.

Alternatively, py-aemreceive (in the appscript svn) provides basic  
support for handling Apple events in Python-based apps. It doesn't  
provide a framework for implementing an Apple Event Object Model  
though, so if you want to do that then you'd need to roll your own  
support (aem references provide a visitor API, AEM_resolve, as a  
starting point).

HTH

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



More information about the Pythonmac-SIG mailing list