Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!udel!gatech!nntp.msstate.edu!olivea!decwrl!parc!rocksanne!fletcher
From: fletcher@mclean.xerox.com (Rick Fletcher)
Subject: Launching native Mac applications from Smalltalk-80
Message-ID: <1994Sep1.180630.17636@news.wrc.xerox.com>
Sender: news@news.wrc.xerox.com
Organization: Xerox Special Information Systems; McLean, Virginia, USA
Date: Thu, 1 Sep 1994 18:06:30 GMT
Lines: 38

We are attempting to launch Macintosh applications from Smalltalk-80 
(VisualWorks 2.0), and have been using third-party code forwarded to us
by ParcPlace Systems.  This code implements a Smalltalk-80 interface to 
Apple events, in effect supplying a thin veneer over the Macintosh Toolbox
calls needed to send and receive the events.  

Unfortunately, this code does not appear to work consistently. An example
supplied with the code sends the Finder an event to display an 'About 
this Macintosh' window; this works most of the time.  A test case we
constructed, to launch the TeachText application, works very occasionally
but usually causes the MacOS error whose code is -609 ('Nonexistent 
application signature or session ID'). We also get this error when the
'About this Macintosh' event fails.  We are using 'ttxt' for the 
Teachtext application signature (and 'MACS' for the Finder signature). 

Because the Open Application ('oapp') event to launch TeachText works 
sometimes, without us changing our code, we suspect a problem in the 
code supplied to us (perhaps in the primitive used to implement 
the SendEvent call to the Toolbox). We have set the 
'High Level Event Aware' bit in the Smalltalk-80 VM, so we are 
relatively sure the event is being sent (and in fact, before the bit 
was sent, we got a MacOS error code telling us to set the bit). 

We have two questions:

1) Has anyone out there successfully used Apple events to launch native Mac
applications from VisualWorks 2.0 or an older version of Smalltalk-80?
If so, is the code available to us for use?

2) Does the behavior we describe above fit anyone's experience with using
Apple events from Smalltalk-80?  If so, any advice on what may be going
wrong?

Thanks very much.


Rick Fletcher
Senior Software Engineer, Xerox Special Information Systems
