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

2007-09-05 Thread Michael Glassford
Karl Sweitzer wrote:
> Is Python's appscript suitable and sufficiently mature for deployment  
> in a commercial application?
> 
> 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.
> 
> 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.  
> Further, we note that appscript has not reached version 1.0.

It has been around for quite some time, however.

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

The Mac version of Goombah (www.goombah.com) uses it.

> Does it deserve active consideration? 

Yes, you should consider it, although only you can determine if it will 
ultimately work for you. The greatest difficulty we had is that, at 
times translating AppleScript commands to appscript commands is tricky 
and there are not a lot of examples available, but we always got it 
working in the end.

> Are there other  
> candidates we should be considering?

Not in Python, that I'm aware of. I believe there are somewhat similar 
libraries for Ruby and Perl, though I have no experience with either.

> If you have an opinion--or better yet, experience in this area--we'd  
> like to hear from you.
> 
> Thanks.

You're welcome.

Mike

___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


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

2007-09-05 Thread Daniel Miller
Karl,




Karl Sweitzer wrote:

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

I've used appscript for simple tasks (e.g. attaching a PDF to an  
email) in an in-house application where I work. It works great for  
what I need to do. My only complaint is that the AppleScript API's  
are not always documented very well--I'm not sure how Word's  
AppleScript is documented. That and AppleScript has the strangest  
grammar I have ever encountered in a programming language.

> 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.

Depending on what you are doing, it may work out well for you to  
write a wrapper (implemented in Python and appscript) around the  
parts of the Word Object Model that you will be using. This would  
provide you with a nicer-to-use API than what appscript will give  
you, and then appscript becomes an implementation detail. Of course  
this may not be an option if you are using too much of the Word  
Object Model.

> 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.
> Further, we note that appscript has not reached version 1.0.

I think you will find Python to be a very nice alternative to VB.  
Make sure you really dig into learning Python. Compared to VB you'll  
find it much simpler to implement many things. But as the saying goes  
"you can write Fortran in any language". Be sure to learn the Python  
conventions and not just translate your VB conventions directly to  
Python.

> Has anybody out there used Python and appscript for a commercial
> product? Does it deserve active consideration? Are there other
> candidates we should be considering?

I would say it definitely deserves some consideration, and I  
personally don't know of any other candidates.

~ Daniel


___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


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

2007-09-05 Thread Karsten Wolf
Hi,


Am 04.09.2007 um 20:29 schrieb Karl Sweitzer:

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

You'll have to find out about the commercial part yourself, but...

I started Python (with appscript, py2app, pyobjc (which you'll all  
need if want to go commercial)) about 5 month ago and it's simply the  
best tool I have.

It takes a while (like any new language you learn) and AppleEvent  
Object hierarchies take their own time until they do what you want...  
plus you not only learn a new language but also some new FrameWorks.


> 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.

I havent looked at recent Office versions but the older ones were  
(IIRC Word 8 or 9) had an impressive AppleEvent dictionary.


> 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.



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

Most open source projects don't have a marketing department that  
pushes version numbers unnecessary. They tick by a different clock...  
and are usable at v0.1 ;-)

appscript is very mature.

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

Not me.

> Does it deserve active consideration?

Yes!

> Are there other
> candidates we should be considering?

The only candidates I would consider also use appscript (rb-appscript  
& objc-appscript; together with py-appscript in the sourceforge  
repository).

If you're into Lisp: there seems to be some decent AppleEvent support  
in one of the commercial Lisps. I haven't used it and am not sure  
which one it was (MCL or LispWorks).

If you find another one, please let me know. I switched over from  
Frontier and have nearly identical opinions about AppleScript...


> If you have an opinion--or better yet, experience in this area--we'd
> like to hear from you.


The ability to develop in an interactive environment (have a look at  
your objects at the command line) together with very rich libraries  
and frameworks and the ability to tap into the world of cocoa make py- 
appscript the __only__ candidate I would consider for your needs



Take a look at the appscript, pyobjc and py2app examples.

http://sourceforge.net/projects/pyobjc/

http://undefined.org/python/py2app.html



-karsten


___
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig


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

2007-09-05 Thread has
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