Re: [OT] My life after AS: shell commands, perl?
Re: [OT] My life after AS: shell commands, perl?
- Subject: Re: [OT] My life after AS: shell commands, perl?
- From: Christopher Nebel <email@hidden>
- Date: Fri, 2 Dec 2005 11:31:14 -0800
On Dec 2, 2005, at 3:55 AM, Serge Belleudy-d'Espinose wrote:
I'm familiar with AS but now I'm building a personal shoutcast
stream and learning everything at once, starting with shell
scripts. My needs are mostly simple text manipulations and
launching commands depending on the environment. My concern is to
choose the right tools, which doesn't have to be the best or the
easiest.
The lazy way: the simplest shell scripts, and tap into AS with
osascript;
Unless you're trying to talk to an application (and Finder and
TextEdit don't count for this discussion), this is a waste of CPU
time. Even if you are, there are more efficient ways.
The normal way: learn shell as much as possible (started here,
http://www.osxfaq.com/Tutorials/) and try to manipulate texts with
sed/awk, although I get the strong feeling that in some cases a
single AS line would do 10 shell commands;
For text manipulation, AppleScript is occasionally more expressively
"dense" (i.e., work performed for the amount of code you have to
write) than shell, but usually the reverse is true -- just look at
Perl's "split" function. I disagree with Mr. McNutt some on the
utility of learning non-Perl tools -- while Perl *can* do anything, a
more focused tool may be more concise. For instance, if I needed to
filter out unique lines, I wouldn't use Perl, I'd use uniq(1). (That
said, learning sed is almost a complete waste of time -- for 90% of
what you're likely to do, "perl -p" will do the same thing with
almost the same syntax, except that you get to use much nicer
regexes. I still prefer to use awk or cut(1) for columnar text, but
that may just be because I've never bothered to fully learn Perl's
auto-split option.)
The learning way: forget AS and learn a more universal language. I
was told that for my needs perl is the way to go. If so, are there
good resources for learning perl (I suppose so) especially when
working on os x?
has already described most of this better than I could, though I'll
give a few additional references:
- Python's standard application-scripting module (not as good as
appscript, but it comes with the system): <http://www.python.org/doc/
2.4.2/mac/scripting.html>
- Building Cocoa applications in Python: <http://developer.apple.com/
cocoa/pyobjc.html>
- "Swiss Army chainsaw": <http://catb.org/~esr/jargon/html/S/Swiss-
Army-chainsaw.html>.
- Eddie, an application that's actually designed to be MPW-like:
<http://www.el34.com/>
--Chris Nebel
AppleScript and Automator Engineering
_______________________________________________
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