[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Interfacing to AppleEvents



At 13.19 97/6/15, Michael G. Schabert wrote:
>>Please, no.
>>1.)  A fundamental problem with AppleScript is its syntax.  Why continue to
>>use it?
>
>Most likely, you use it every day of your Mac life, you just don't see it.
>It is an unavoidable and necessary part of the Mac at the moment.

It's not only unlikely but untrue.  I use Apple Events a lot, and
AppleScript usually only as a debugging tool for the Apple Events.


>>3.)  AppleScript is NOT a common language all Macs speak.  Apple Events
>>are.  AppleScript puts a user language (one I don't particularly like) on
>>top of the Events.
>
>AppleScript has been given with every system since 7.1, & fully supported
>in 7.1.2 (system 7.1 plus scriptable finder).


But apps do not speak AppleScript.  An application has no knowledge of
AppleScript.  It knows Apple Events.  AppleScript is a scripting language
on top of the Apple Events.  The app knows absolutely no difference between
MacPerl and AppleScript calls.  It works like this:

MacPerl script --------> Apple Events ----> Application
AppleScript script ----> Apple Events ----> Application

Apple Events are the lingua franca of Mac apps.  AppleScript is no
different than MacPerl as far as the apps are concerned.  There is a
specific difference between Scripts and Events that you are missing.


>>And for connect:
>>DoAE('','PPP connect',{address=>'555-1212',
>>                       'user name'=>'chrisn',
>>                       password=>'pass'}) || die $!;
>>
>>Obviously, a lot of AEs get more complicated than that, too.  But it's just
>>an idea of how they might look.  I know that it looks beautiful to me.
>
>Did you just say that something that's almost exactly AppleScript is
>Beautiful??? Make up your mind!

This is not almost exactly like AppleScript in syntax.  It is similar, but
certainly has some key differences.  In one you have a statement containing
a command and a set of arbitrary parameters.  In the other you have a
statement containing a value that is equivalent to a command, and an
associative array containing key/value pairs as parameters.

The similarities you see are due to one unchangeable fact and one thing
which would make things simpler.
1.)  They are similar in how the Apple Event suite dictates them to be
similar.  The app defines what parameters are required for a given AE.  So
whether you are using AS or Perl, you have to name the AE and give the
parameters.  But the syntax for describing these can be, and in this case
are, different.
2.)  They are similar in the vocabulary used.  As the AppleScript
vocabulary is more accessible and easily-understood than the straight AE
keywords in the aete resources (in this case 'PPP connect' instead of
'RAco'), it would probably make sense to use those.  But the syntax itself
is still quite different.

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch