Re: Scripting Additions: Embracing the Horror of Unix
Re: Scripting Additions: Embracing the Horror of Unix
- Subject: Re: Scripting Additions: Embracing the Horror of Unix
- From: email@hidden (Michael Sullivan)
- Date: Fri, 1 Feb 2002 11:48:04 -0500
- Organization: Society for the Incurably Pompous
Shane Stanley writes:
>
On 1/2/02 8:17 AM +1000, garbanzito, email@hidden, wrote:
[unix shell calls from AS]
>
Excellent info, thanks. FWIW, I'm keen to learn this stuff from a general
>
system
>
point of view. I just don't want to see AS corrupted to the point of
>
_relying_ on a knowledge of it.
I'm not sure I get this point of view at all. You can't really script
the finder in other than a rudimentary way unless you understand a fair
bit about the underlying architecture of the mac, and how the finder
organizes it's commands, etc. That's true of every app you might decide
to script.
Similarly, if you want to use the unix shells, you've got to understand
their structure and language as well. There are those who find it
*more* rather than less elegant than Applescript.
What I'd like to see in AS is the ability to write whole shell scripts
in the editor as you would write them in a unix text editor, rather than
having to code them all as strings:
So you could write something like:
shell script "[sh|csh|ksh|perl|other supported dialect]" nameOfScript
-- insert unix command script from appropriate shell language here
end shell script
This would return a shell script object (which could display as a plain
string) which one could then call with
do shell script nameOfScript
Appropriate quoting and passing would all be done as needed that on the
do call, it would work exactly as if you ran that script from the shell.
A couple of unix commands to massage normal apple style file specs and
expressions into something that will pass muster in a shell script could
be written and thus could be called in the shell script.
It would be gravy if some of the cool OO features of AS scripts, such as
properties and AS style handlers were also supported by these AS
compiled shell scripts. You could then write a shell script object like
an AS script object and give it properties (data members), and handlers
(method members) that could be accessed in AS traditional style by AS
client scripts.
Is this kind of what you're thinking of Shane?
I wonder if Chris or Jon has a comment on how feasible something like
this is? Could it be implemented purely in third party editors without
assistance from apple? Is Mark Aldritt out there listening? He seems
to be all about supporting OSA languages other than AS?
At the least, writing some unix programs to automate some of the hairier
quoting and escaping in the shell might not be all that difficult for
someone with a unix programming background. I wouldn't be at all
surprised if there are some open source tools like that out there
already that could be adapted to the purpose.
I suspect that what Shane would *really* like (and I think this would be
great but possibly not worth the development effort) is a shell that is
AE scriptable. Only problem is I'm not sure of the relative
architectural depths of shells and OSA. I fear that such a project
would be forced by the OSA architecture to give up a lot of the speed
and power of shell scripts, which would kind of destroy the point.
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden