[Pythonmac-SIG] Applescript

Jack Jansen Jack.Jansen at cwi.nl
Wed Jan 7 18:05:45 EST 2004


On 7-jan-04, at 17:26, has wrote:
> BTW, one other thing: it'll save you a LOT of mental anguish if you  
> realise from the start that application objects are referred to using  
> basic relational queries [4]. Most folk don't realise this, especially  
> since AppleScript uses syntax that looks much like standard OO [5]. I  
> posted a message to the MACSCRPT list in the last couple of days where  
> I've talked about this issue; I do recommend you check it out. Here's  
> the archives; look for the 'Perl (and Python)' thread:
>
> <http://listserv.dartmouth.edu/scripts/wa.exe? 
> A0=macscrpt&D=1&H=0&O=D&T=1>

This paragraph leads me to believe that you're the first person (or one  
of the first people) I've met in my 8 year quest to understand the  
AppleScript machinery who actually understands what is going on.  
Unfortunately, however, I'm not sure I understand what you're saying,  
either in this paragraph or in the discussion on the scripting mailing  
list.

It would help me immensely if you could help me (and probably numerous  
others) get things straight....

Here's what I understand so far, please tell me what's wrong with this,  
and where I miss things.

The whole things is a layered set of protocols and APIs. At the very  
bottom we have IAC (Inter-Application Communication), which is  
basically a low-level API to do message passing, both inter and  
intra-machine. Under OS9 you could use this raw, but as far as I can  
tell that is no longer true under OSX.

The next level up is AppleEvents, which is a number of things all  
entangled:
1. An API for doing RPC (remote procedure calls),
2. A data encoding format for RPC parameters (similar to what ASN-1 or  
XDR provides),
3. A data model (classes, properties, iterators, tests, etc),
4. An API for encoding and decoding the format of (2) and (3).
All in all this level provides similar services to what COM or Corba  
provides.

Then there's dictionary/terminology level, which is really unclear to  
me. In part it is part of the previous level. In part it is a level by  
itself: it allows applications to build on the data model and define  
which classes, properties, etc. it supports and communicate that to  
other applications. In part it is part of the next level: all sorts of  
AppleScript words appear in the dictionaries. Documentation on this  
level appears to be completely lacking: getting the terminology  
resource of application is a black art (sometimes you can use  
AppleEvents to get it, sometimes you have to hunt for an 'aeut' or  
'aete' resource, sometimes there's only an XML file in an unspecified  
format).

Next level up is actual scripting languages. AppleScript is the main  
one here, but in principle  this level is open. Frontier is (or used to  
be) another scripting language within this architecture, and we want  
Python to be usable at this level too.

Next level up is the OSA (Open Scripting Architecture) API. OSA is used  
by Apple sometimes to denote this whole stack of layers, sometimes to  
denote only this level (the topmost one). The OSA API seems to refer  
only to the topmost layer. This is the API used by host applications,  
and it should in principle allow an application to be  
scripting-language-agnostic: if you are a server for the AppleEvents  
level and a client to the OSA API level users can use any scripting  
language to script your application. And of course you can also be only  
a server (most scriptable applications) or client (MacPython 2.3).
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman




More information about the Pythonmac-SIG mailing list