Re: AppleScript / Perl comparison
Re: AppleScript / Perl comparison
- Subject: Re: AppleScript / Perl comparison
- From: has <email@hidden>
- Date: Mon, 24 May 2004 22:40:46 +0100
Doug McNutt wrote:
Graphically controlled applications in the Macintosh OS are pretty
much forced into external communication and control via the open
scripting architecture (OSA) provided by Apple.
Incorrect. Traditionally the standard mechanism for Mac IAC
[inter-application communication] is Apple events, which are handled
by the Apple Event Manager. But it's by no means the only one: the
classic Mac OS supported lower-level communication via the PPC
Toolbox, while OS X supports higher-level communication via
Distributed Objects plus whatever lower-level mechanisms.
OSA merely provides a basic framework for creating swappable
scripting language components, which lets users write scripts in any
OSA language using any OSA editor, and supporting attachability in
applications, which lets users attach scripts written in
OSA-compliant languages to menus and other objects in those
applications.
Documentation is provided by applications is in the form of
"dictionaries" which use the language of AppleScript. unless you
want to pay someone to translate it.
While there are some problems translating application terminology to
other languages, it's certainly possible. Perl and Python both
translate application-specific keywords to native identifiers, and
while the transformation is lossy (since these languages only support
alphanumeric and underscore characters in identifiers) in practice
it's really pretty safe (I've yet to find an application where it's a
problem).
The underlying codes of OSA and high level events are almost
impossible to discover.
Actually it's pretty easy for applications that include scripting
terminology resources. The Smile and Script Debugger editors both
allow keywords to be translated to AE codes, and the Perl and Python
AEM bridges both include AETE [raw terminology resource] parsers and
can display raw AE codes for little or no extra effort.
By and large you shouldn't need raw codes, however.
Frontier, Smile, Java are options that I'm not qualified to discuss.
(And I'm sure some would include AppleScript in that list.)
AppleScript Is Not Cee. Go read up on Smalltalk if you really want a
better understanding of how the AppleScript language works.
So. . . You need to study AppleScript just to read the documentation
even if you only use OSA through calls from perl, a shell, or
something you write yourself.
There's an element of truth in this; but _only_ because existing
documentation on application scripting is all written for AppleScript
users. Cross my palm with sufficient silver and I'm sure the
MacPython IAC docs could magically finish themselves in a week. ;)
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.