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

Re: [MacPerl] MacPerl/Script



        Reply to:   RE>[MacPerl] MacPerl/Scriptable apps big picture?

Fred,

Fred -- Here is my cut on it.

It sounds like you have all the pieces but you need a master program to tie
them together.  Perl is an excellent glue code for putting disparate pieces
together.  Every DoAppleScript guarantees that it finishes before starting the
next piece.  After completion of each part, you might create an error checking
interface (verify the AppleScript has expected output) and do the next "text"
processing before the next AppleScript.

In that way you can keep layering it and testing out pieces.  It also gives
you an opportunity to add error checking in between each script.

In my opinion I would use the Perl as the master driver and keep the
AppleScripts as containable as possbile -- smaller scripts that can be debuged
and developed separately.  Look for a rhyme or reason to the perl process
where you can make a more general model if possible.

You might use an Ascii text file which defines for perl what scripts to
execute and what text processing to do in between each step.  An associative
array is great for defining keywords and actions.

$Action{$keyword}

  e.g.    script <script file>
           index <file> <output_index>
           toc <file> <output_toc>
           combine <output_toc> <file> <output_index> 
           script <next script file>

Where script represents call the proper script file as specified.
Index represents a perl routine to make an index.  Toc is a perl
routine to create a table of contents.  Combine is a perl routine
to combine those results.  And script, again, is another AppleScript
to continue outside processling.

This makes you independent of single programming efforts and
encourages you to create general solutions. 

Good luck,

David Scott
Sequana Therapeutics

--------------------------------------
Date: 8/11/96 8:32 PM
To: David Scott
From: Fred Toth
Hi all. I'm begging your indulgence here, but can someone give me the
big picture on the relationship between MacPerl and Scriptable applications?

To clarify my question: I've done some (too) extensive AppleScripts to
control Quark Xpress and found it to be an ugly business (though it does
in fact work mostly). I'm now gearing up to dive into Frontier, because the
menu sharing stuff is great for simple Quark users, and it's supposed
to be much faster than AppleScript.

Of course, what I'd really love to do is let MacPerl do all of the work,
especially the text processing, if possible (since basic text work
is all but impossible with AppleScript).

I've followed this list for some time, and watched with great interest
the discussions of MacPerl and toolbox access to Apple events, interfaces
to Frontier, OSA efforts, etc. I know things are in a state of flux...

But, I confess, I still can't get the big picture. If some kind soul
could boil it down a bit. Just what might be the best way to drive
Quark Xpress or similar? I'd like to grab text out of Quark and pass
it off to MacPerl for processing, then get it back into Quark, with
or without Frontier involved, etc.

If someone could share their model of how this should work, I'd
be grateful.

Many thanks,

Fred Toth
ftoth@synernet.com