[Sussex] AppleScript and Red Hat 8.0

Geoff Teale Geoff.Teale at claybrook.co.uk
Tue Oct 22 10:16:01 UTC 2002


Morning,

Tony Dart wrote:
----------------
> "Anything they Mac
> > stand at LINUX Expo can do on OS X 10.2 I can do on my 
> LINUX box too!".
> >
> quoth Geoff T - and a bold claim it is too ...

Should point out right from the start that this was a specific reference to
the transparancy controls in Mac OS X 10.2 to Gareth, Steve and I.  As
someone who now regularly uses OS X (on Sarah's iMac) I have nothing but
respect for that OS.

However.  Having made the statement I shall attempt to defend it, if for no
other reason than sharpening my debating skills and demonstrating my bloody
mindedness ;)

> Geoff, what would you recommend to look at as the equivalent 
> of AppleScript
> for Linux? (AppleScript is a scripting language that not only 
> controls most
> of the OS but also most of the major apps, allowing you to write glue
> routines for automation).

AppleScript is able to control applications because they support a simple
standard for API's in the OS X environment (yes, AppleScript existed prior
to OS X, but it certainly has moved along since).  In this respect
AppleScript is the same as any other programming language.  What makes
AppleScript so useful is that it is a Standard set by the OS manufaturer and
so most major application do indeed support AppleScript automation.
Moreover Apple has proveded a nice IDE called AppleScriptStudio.  

That said though, AppleScript does not extend to all applications and the
level control is always dependent on what parts of the applications API are
exposed.  At the end of the day you are limited to what the application
programmers have chosen to give you.  This, as I said, is the same as any
application and any programming language.

It is true that LINUX does not have a standard scripting language, but there
are two things that need to be pointed out:

1. UNIX Philosophy
==================

In the UNIX world there is a principle that programs should be written to do
one job and do that job well.  Each little program should be powerful enough
to cover ever aspect of the job that it's doing.  If there is some extra
functionality required that doesn't fall into the realm of the programs
operation then the correct way to gain this functionality is to stream or
"pipe" output from one program into another.  None of these seems very
exciting now, but it is, and always has been one of the most important
things about UNIX.  The simple ability to combine applications thus:

ls -l /usr/bin | grep ^tux

... is the first step to a truely powerful scripting environment.  

In this modern GUI obsessed world people seem unwilling to delve into the
wonderful array of programs without icons, and that's a shame.  The thing
is,  most tasks that don't require human interaction don't require GUI's
either.  The noteable exceptions are Macros to make human interaction easier
- but I don't think you're talking about that kind of scripting with
AppleScript.  Pretty much any major automation you can think of can be
achieved _easily_ in any UNIX system, be that Solaris, *BSD, LINUX or OS X
itself.  What language and tools to you use to do this?  Well that's my
second point...


2. Languages and Interfaces
===========================

So we don't have any AppleScript equivalent.  But we do have:

PERL
PHP
Python
Ruby
Rebol
REXX
Shell Scripting
etc.. etc... etc...

As far as scripting the execution and communication of small command line
programs is concerned you can use pretty much anything and thus _do_ pretty
much anything - upto and including complex graphical processing and the
creation of documents in almost any format.  All of this can be achieved
without once ever needing a GUI application, and very little more knowledge
than is required to use each individual application.

By now, I'm sure you're screaming about the times when you do actually do
want to script for GUI applications.  OK, well, from this front we're in
exactly the same situation as for any program on any platform.  GUI
applications do not particularly suit the "piping" of information through
them so the Shell Scripting option is pretty much lost to us, but what about
all those other languages?

Well, much the same as AppleScript really.  The majority of major
applications provide API's for C/C++ as a side product of writing them.
Once an API for C/C++ exists it is only a matter of time an will before
API's start appearing for everything else (as it is almost universally the
case that a scripting API is just a C/C++ API wrapper that complies to the
standards of the target language).  

If you live in the PERL community you'll find that you can get to scipt
pretty much everything you ever want.  PHP, Python, Ruby and the rest lag
behind a little in support, but some (ie. Python, Ruby)  are growing rapidly
in terms of support as people move towards their cleaner syntax and
implementation.

The real difference between these languages and AppleScript is the same
things that effects everything in LINUX.  There is no one single body
governing the platform.  This is both LINUX's greatest strength and one of
it's weaknesses.  Ultimately LINUX gets better toolsets and adopts informal
standards by a truely darwinian approach - the best tool rises to the top -
but in the short-term the average user has to wade through a sea of options
to try and guess at what is the best for them.


> Also RH 8 - speaking as a suit, I want a version of Network 
> Neighbourhood
> for the office, synchronised passwords when I log on my Linux 
> client to the
> NT server, and the ability to easily change screen display 
> resolution - all
> seem to be missing from RH7.3.

OK.

1. Network Neighbourhood.  
=========================
Well, a lot of LINUX distros do this.  Red Hat / Gnome doesn't by default.
I'll check for this in 8.0 - plan to do the install tonight!  Of course this
is only an issue in an environment with Windows machines involved...

2. Passwords 
=============
SAMBA provides a level of unification of user management across platforms
that NT/2000 cannot.  Your problem is running an NT server, not running a
LINUX client. Straw poll.  How many people think they are likely to be in an
office where LINUX is on the desktop but Windows is being used as a
fileserver?


3. Easy resolution setting / changing
======================================
This is more to do with the way XFree86 works.  You can't switch to a mode
that wasn't defined at startup (defined modes can be switched using 
ctrl-alt-keypad_plus/minus).  I've seen nice(r) graphical setup tools for X
(like SuSE's SAX2) but these still require you to restart XFree86 to use the
new settings - nothing makes it a simple one stage step.  

The good news is that HP submitted a patch to XFree86 this week (it was on
Slashdot if you weren't watching) call RandR.  It's entire purpose is to
allow inline resolution changing and resizing (a la Windows, MacOS.. etc) in
the manner you describe.  All it needs is for someone to write a front end
to support the functionality.  I'd expect to see that in Red Hat 8.1, SuSE
8.2 or 9.0 and, for the adventurous, on Gentoo by the middle of next week.
:)

> See you all Thursday week!

See you there.

-- 
GJT
geoff.teale at claybrook.co.uk




The above information is confidential to the addressee and may be privileged.  Unauthorised access and use is prohibited.
 
Internet communications are not secure and therefore this Company does not accept legal responsibility for the contents of this message.
 
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
 
Claybrook Computing Limited is a subsidiary of Claybrook Computing (Holdings) Limited
Registered Office: Abbey House. 282 Farnborough Road, Farnborough, Hampshire GU14 7NJ
Registered in England and Wales No 1287205
 
A Hogg Robinson plc company





More information about the Sussex mailing list