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

Re: About Apple Events



Excerpts from netnews.comp.lang.lisp.mcl: 12-Nov-93 About Apple Events
by Herve Blanchon@imag.fr 

> I want MCL to send messages to HyperCard but not 'eval' or 'dosc'. I 
> want to send my proper events. I have an event class 'LIDI' and event
> IDs.
> 

Presumably you mean that you've gotten Hypercard to install AppleEvent
handlers for your custom events. Hypercard can only respond to events it
knows about (and has told the operating system about). That being the
case, you should be able to call something like this:

(defun send-ae (event-class event-id)
  (with-aedescs (appleevent reply target)
    (ccl::create-signature-target target :WILD) ;WILD is Hypercard
    (apply 'create-appleevent appleevent event-class event-id target nil)
;;    set parameters for the outgoing appleevent
;;    (ccl::ae-put-parameter-char appleevent #$keyDirectObject "Hello")
    (send-appleevent appleevent reply 
            :reply-mode :wait-reply
            :interact-mode :always-interact
            :timeout 600
            :can-switch-layer t)
;;    look at the reply here
;;  (ccl::ae-get-parameter-char reply #$keyDirectObject)
  ))

where, for you, event class is :|LIDI| and event id is whatever your ids are.

ae-put-parameter-char is used to set a parameter of the appleevent (when
the parameter is a string). The #$keyDirectObject parameter is used in a
lot of appleevents, but you can use anything you like for your custom
events. ae-put-parameter-longint and ae-put-parameter-type (for an
os-type) are also defined. If your parameter is not any of these types,
you can use #_AEPutParamPtr.

You can look at the reply you get using ae-get-parameter-char (or
longint or type).

As far as I know, there is no documentation for ae-put-* or ae-get-*,
but they work just like AEPutParamPtr and AEGetParamPtr.

If you plan to do much with AppleEvents, you will have to get the new
Inside Mac: Interapplication Communications.

Hope this helps

Steve