[Pythonmac-SIG] Making a Python application scriptable via AppleScript
Ned Deily
nad at acm.org
Sun Aug 9 00:02:53 CEST 2009
In article <4A7DCDBA.9060705 at codebykevin.com>,
Kevin Walzer <kw at codebykevin.com> 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.
>
> Any advice is apprecaited.
I have no personal experience but I imagine, perhaps naively, that the
"right way" to do that these days would be to use PyObjC and py2app to
create a Cocoa application and then build upon Cocoa's built-in support
for Apple events. Presumably that would include supplying an sdef and
modifying the app bundle's Info.plist to enable scripting as outlined
here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoa
Applications/SApps_implement/SAppsImplement.html#//apple_ref/doc/uid/2000
0037-BAJBBDFE
--
Ned Deily,
nad at acm.org
More information about the Pythonmac-SIG
mailing list