Re: To shell or not to shell (was Re: URL Access Redux)
Re: To shell or not to shell (was Re: URL Access Redux)
- Subject: Re: To shell or not to shell (was Re: URL Access Redux)
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 22 May 2006 21:48:18 -0400
On 5/22/06,
Stockly, Ed <
email@hidden> wrote:
I think a new scripter, trying to build a small inDesign workflow or maintain a personal website or automate his personal email, the kind of person the AppleScript language was designed for, would read through a few emails on this list and be scared away from AppleScript needlessly because a few scripters have a preference for shell scripting and believe the answer to every AppleScript problem is to have an AppleScript call a shell script.
I somewhat agree. I mean, I'm a hardcore UNIX guy from way back, and I think shellscripting is an amazing and powerful tool for a wide variety of purposes. But while there are some cases where the simplest solution from AS may be to call out to the shell - which is why "do shell script" exists - I would say that often, perhaps most of the time, that's wholly inappropriate. If you wind up doing a lot of shell from your AS, then I have to wonder why you're using AS at all instead of a pure-shell solution. If it's just for the user interaction, there are probably better solutions in some other programming environment, like maybe Tk plus Perl/Python/Ruby/TCL. Or RealBASIC, but that's way 'spensive.
AppleScript's functional strengths lie in automating Apple Events-aware applications. It's aesthetic strengths lie in its (sometimes deceptively) simple syntax. Shell scripts have a relatively arcane syntax and don't do you any good from an application automation perspective (except for the occasional ported UNIX app that provides a shell interface for automation...). So they're really complementary, and which you should use depends on what you're doing. An AppleScript that consists of a bunch of "do shell script" statements isn't taking advantage of the host language; it's like all those first Perl programs that consist almost entirely of shell commands in backticks.
--
Mark J. Reed <
email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden