[Pythonmac-SIG] Python+Automator?

Bob Ippolito bob at redivi.com
Mon Jan 24 18:15:57 CET 2005


On Jan 24, 2005, at 12:06, has wrote:

> Bob wrote:
>
>>>> Given the description, it would be trivial to write an Automator 
>>>> Action in PyObjC 1.2+ using the py2app plug-in bundle support.
>>>
>>> Cool. How hard would it be to provide casual users a more Pythonic, 
>>> easy-to-use API over part or all of that, you think?
>>
>> The Objective-C API is going to be faster and richer anyway, I don't 
>> see a reason to care about the OSA interface for Automator in this 
>> context.
>
> PyObjC is a great piece of kit and definitely the way for professional 
> developers to go, but not every Python user is a technical whizz and I 
> can see the PyObjC route being somewhat overwhelming for newbies and 
> casual scripters.
>
> Not every user wants, needs or can immediately handle a professional 
> Word/Photoshop/Cumulus/Quark publishing workflow, for example. Some 
> will be much better catered for by something like Pages, which offers 
> less functionality and control but presents it in a way that makes it 
> much easier for non-professionals to use. Less is More, in other 
> words.
>
> Same sort of idea here: after all, Automator itself is just a GUI 
> version of Unix pipes and commands, repackaged to suit a different 
> audience. Apple's obviously planning to market AppleScript as the 
> amateur's route into the underpinnings, and ObjC for the 
> professionals. Python easily nails the latter group thanks to PyObjC; 
> what I'm wondering here is how well it's going to cater to the former?
>
> Sure as guns, there's going to lots of be Automator users who sooner 
> or later need a custom action, and often that'll mean they'll be going 
> under the hood themselves. A simple, cut-down, newbie-friendly API 
> might make all the difference in bringing these folks to Python, 
> giving them an easy way to get their foot in the door. The alternative 
> is losing that potential audience to AppleScript - a far inferior 
> platform in technical terms, but one which knows a thing or two about 
> presenting itself in a newbie-friendly form.
>
> It's a question of marketing really: what type(s) of audience do you 
> wish to promote Python to, and what needs to be done to guarantee 
> each's capture?

 From the public documentation, you would trivially construct an Action 
in PyObjC with the following boilerplate:

# MyAction.py
from Foundation import *
class MyAction(NSObject):
     def runWithInput_fromAction_error_(self, theInput, anAction):
         if somethingBadHappens:
             result = None
             error = someNSError
         else:
             result = [some output]
             error = None
         return result, error

Is that so overwhelming?  Do you think that given an Xcode template 
(that has this code, plus the Info.plist boilerplate), people won't be 
able to fill some code in and hit the build button?

-bob



More information about the Pythonmac-SIG mailing list