[Pythonmac-SIG] Python/appscript ready for primetime?

has hengist.podd at virgin.net
Wed Sep 5 23:24:55 CEST 2007


Karl Sweitzer wrote:

> Is Python's appscript suitable and sufficiently mature for  
> deployment in a commercial application?

For Apple event IPC, yes. Py-appscript has been around since 2003 and  
provides the same level of functionality as AppleScript and virtually  
[1] the same level of application compatibility.

If you also need OSA attachability support (which allows you to  
attach scripts to applications that support it, e.g. Mail rules,  
folder actions), AppleScript remains the most dependable option here.  
There is a PyOSA component on the appscript site that's usable with  
care, but it's not yet mature enough for deploying in the wild.


> With the demise of VBA in Microsoft Office, we are faced with  
> transitioning scripts that manipulate equations in Office and  
> manage the interoperation of our application with Office.  
> AppleScript is an obvious candidate, but coyote ugly in the eyes of  
> many developers, including us. We are looking for viable alternatives.

AppleScript is the benchmark by which other Apple event bridges are  
best measured (even if the language sucks in other respects), since  
that's what application developers generally develop and test  
against. Of the third-party alternatives, appscript is  by far the  
best candidate. The Python and Ruby versions are quite mature; the  
ObjC version still needs a bit of work (I just need to make some time  
for it) though is already pretty usable.


> Python, augmented by appscript to access the Word Object Model, is  
> the best candidate we've identified thus far. However, we have  
> negligible experience with Python and zero experience with appscript.

For general advice on Python, best place to ask is comp.lang.python.  
For Mac-specific advice, including questions on appscript, ask here.  
For Mac Office advice, probably best to start with the  
microsoft.public.mac.office.* newsgroups. Best person to speak to  
about Office scripting is Paul Berkowitz, author of MacTech's VBA-to- 
AppleScript transition guide which you'll no doubt want to read if  
you've not already done so. Another person you might want to speak to  
is Matt Neuburg, author of "AppleScript: The Definitive Guide" (which  
I'd recommend buying if you need to learn AppleScript). And I'll be  
happy to provide advice on AppleScript and appscript, of course.


> Further, we note that appscript has not reached version 1.0.

Sub-1.0 version numbers are pretty common in OSS, and don't tell you  
much about a project's functionality/reliability/stability/maturity.  
The core appscript modules (CarbonX.AE, aem, appscript) have been  
pretty stable over the last couple years; one or two significant API  
shake-ups, but mainly just periodical bug fixes, feature enhancements  
and/or compatibility improvements. The Ruby version of appscript  
recently went beta, and I'm hoping to do the same with the Python  
version sometime before the year's end.

BTW, I am planning some changes for the next release of py-appscript  
as part of the pre-beta tidy-up - ask if you want details - but  
nothing that'll stop you using it right now. There's also work to do  
on 64-bit compatibility (this is true of all Mac-specific Python  
extensions that need it, btw, including those in the standard  
library), which will happen sometime after Leopard's release once I  
can afford a new laptop.


> Has anybody out there used Python and appscript for a commercial  
> product?

I believe Omni are using Rails and rb-appscript to provide a web  
interface to their upcoming OmniFocus product, and there may be  
others I don't know about.


> Are there other candidates we should be considering?

Python/Ruby/ObjC appscript would be your best choice; as well as  
being the best third-party Apple event bridge, it also provides  
several very useful developer tools:

- built-in help systems for exploring dictionaries and object models  
in interactive Python and Ruby interpreters (the osadict command-line  
tool bundled with py-appscript also provides access to most of this  
system, which is handy if you're using objc-appscript)

- ASDictionary for exporting application dictionaries to HTML in  
AppleScript and Python/Ruby/ObjC appscript formats

- ASTranslate for converting application commands from AppleScript to  
Python or Ruby appscript syntax.


If you want a list of all the other available bridges then just let  
us know, although there aren't any I would recommend.

HTH

has

[1] There may still be the odd as-yet undiscovered compatibility  
issue since there are a lot of quirky applications out there. I think  
I've dealt with 3 or 4 this year, though new reports are increasingly  
rare as appscript is pretty good these days at mimicking  
AppleScript's own undocumented quirks and general sloppiness.  
However, if you should discover any compatibility problems that don't  
exist in AppleScript then file a bug report and I'll fix them and/or  
provide a suitable workaround ASAP.

-- 
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org



More information about the Pythonmac-SIG mailing list