[Pythonmac-SIG] Python+Automator?

Bob Ippolito bob at redivi.com
Mon Jan 24 06:40:50 CET 2005


On Jan 24, 2005, at 0:10, Paul Berkowitz wrote:

> On 1/23/05 7:53 PM, "Bob Ippolito" <bob at redivi.com> wrote:
>
>>>> Given the description, it would be trivial to write an Automator
>>>> Action in PyObjC 1.2+ using the py2app plug-in bundle support.  I
>>>> doubt I'll be using Automator often enough to become a PyObjC
>>>> Automator evangelist though.
>>>
>>> What's the advantage of PyObjC here? Just because it makes it easier
>>> to write the plugin, or does it help with writing the Python code 
>>> too?
>>>
>>> Because I wouldn't mind having automator support in a future
>>> "MacPython for Tiger additions"...
>>
>> The advantage of PyObjC here is that there are two interfaces for
>> creating plugins: Objective-C plugins that implement a certain method,
>> and applescripts that implement a certain handler.  Since the latter
>> isn't really possible to do with Python, that leaves PyObjC as the 
>> ONLY
>> option, and it happens to be trivial to do.
>
> Except that you can only write Objective-C Automator actions for Cocoa 
> apps
> which expose their entire APIs publicly. Only a few Apple apps do that.
> Nobody else will do it - their developers might write their own Obj-C
> actions but they won't open source their apps for others to do it. On 
> the
> other hand, all applescriptable apps are immediately accessible to
> AppleScript Automator actions. You can cut out a lot of the "internal"
> scripting by using Cocoa Bindings (as for Obj-C actions) but need
> AppleScript to talk to the apps. Probably has's appscript will be able 
> to do
> the same in Python. I can't see how far anyone is going to get with 
> PyObjC
> except for their own apps, and Apple's Address Book, which Apple is 
> already
> providing many actions for.

You're totally wrong here.  Automator actions *entirely separate* from 
applications!  Apple applications will not and can not support 
Automator actions directly, but they may ship with Automator actions.  
Whether these actions communicate with their application via Apple 
Events, Distributed Objects, or simply link with the same code and do 
things directly is beside the point entirely.

Objective-C actions can perform a superset of what AppleScript actions 
can do, including sending apple events to other applications, so your 
rant makes no sense.  Yes, you could use appscript from a PyObjC 
plugin.  I would expect that the majority of actions that people will 
write in Python will do very little inter-application communication 
anyway and instead will do things that Python is significantly better 
than AppleScript at (doing stuff on a network, mangling files, calling 
into Objective-C frameworks, etc.).

-bob



More information about the Pythonmac-SIG mailing list