[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Applescript and AppleEvents from within MacPerl



I need to control the desktop ppublishing program QuarkXPress by a program.
Until now, I've used Applescript for this. But really, this is pretty much
garbage: it is *very* slow. This is most annoying if you need to do a lot of
preprocessing (mostly string handling) before sending commands to Quark.

I've noticed that MacPerl allows the programmer to include bits of
Applescript code. This is a very impressive gimmick, although very useless.

If you try to "compile" an Applescript script from within the script editor,
it may take well over half a minute to do this, for a 10k source file (about
3 pages). But this is only once.

In MacPerl, you pass the applescript as *text* to the function call, so it
gets compiled *every time* (I believe MacPerl uses the Mac's built-in
functionality for this). Try doing *that*, say, 1000 times in a loop!

So, here's my question: is it possible to use AppleEvents in a more direct
manner, than by using MacPerl::Applescript? What about something like
MacPerl::AppleEvent (I just made this up)?

If this is the case (or maybe in the future), how to make a module
containing the commands for QXP? As a thought, it could be possible to use
the "glue table" from Frontier for this. This scripting program contains a
table with 685 entries, most of them 4 character constants, but also some
2-line scripts like the following:

        on doupdates()
                return(appleEvent(QXP.id,'XPRS','XUPD'))


Has anybody already done any work in this field? Is there an interest for
this kind of stuff, or am I the only one?


Bart Lateur,        
Gent, Belgium.