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: garbanzito <email@hidden>
- Date: Tue, 29 Jan 2002 13:56:43 -0700
at 2002 01 28, 22:36 -0800, they whom i call Jon Pugh wrote:
These unix shells will probably make most scripting additions unnecessary.
yes, we are so used to the idiosyncratic syntax of scripting
additions, why not think of shell commands as one big OSAX
with gnarly syntax rules... i really don't see the OSAX
world as some kind of beautiful, well-worked out syntactical
heaven.
as to the argument that you can read the dictionary of
scripting additions, so can you read the man pages (ManOpen
is a nice GUI app for this), which are much more time-tested
and vetted for accuracy. many dictionaries are just plain
wrong, and they usually don't have detailed background info
built in.
i do think OSAXen are useful for their speed and slightly
more "normal" syntax. but i think on Mac OS X a scriptable
background application might be just as fast (once
launched). using apps instead of OSAX clears up the
namespace issue a bit too.
one big advantage for the shell: it's installed by default.
do shell script ("cp " & posix path of sourceFile & space & posix
path of destinationDir)
use /Developer/Tools/CpMac if you want to keep your resource forks!
(or ditto if you don't want to assume the dev tools are installed.)
Of course, cosmic unix power doesn't get you anything like the way
cool implementation of things like "walk folders" which doesn't have
any corresponding unix tool with the simplicity it provides.
not as simple, but not too hard. the key is if you want to
package the functionality in a more approachable, simplified
package, then an OSAX (or a scriptable app) would be
better.
but i would suggest a more generalized, and possibly more
useful OSAX, would be something like "walk items" that would
flexibly pass every "item" of it's argument to a handler if
it passed a test. this way i could process the output of "ls
-Rv1" or any one of thousands of shell commands, as well as
the result of various script commands. sort of an advanced
repeat --
repeat with (item) in (list|text|container) using (script)
the (list|text|container) argument would be where the
flexibility would come in, and it would be evaluated only
once up front.
--
steve harley email@hidden