Lisp HUG Maillist Archive

Sending Apple Events

Does anyone know of a way to send an appleevent under Mac OS X from
LispWorks?

What I want to do is something like this (which is how you do it in
Macintosh Common LISP):

(defun send-event (n)
  (with-aedescs (appleevent reply target)
    (create-named-process-target target "MyApp")
    (create-appleevent appleevent :|PKPr| :|Tick| target)
    (ae-put-parameter-longinteger appleevent #$keyDirectObject n)
    (send-appleevent appleevent reply :reply-mode :no-reply)))

I can't find any reference to appleevents in the CAPI manuals.

Thanks,
David Johnson-Davies

+------------------------------------------------------------+
David Johnson-Davies, Human-Computer Interface Ltd
17 Signet Court, Swanns Road, Cambridge, CB5 8LA, England.

Tel: +44 1223 314934, Fax: +44 1223 462562
Email: david@interface.co.uk, Web: http://www.interface.co.uk/
+------------------------------------------------------------+



Re: Sending Apple Events


On May 1, 2008, at 11:33 AM, David Johnson-Davies wrote:

> Does anyone know of a way to send an appleevent under Mac OS X from
> LispWorks?
>

To do it exactly like you have it in MCL will require some work with  
the FLI and/or Cocoa interfaces. If your needs are simple, it might be  
a lot easier to call an Apple Script or call osascript (see man  
osascript). Here is an example:

(system:call-system "osascript -e 'tell application \"iTunes\"' -e  
'play' -e 'end tell'")


John DeSoi, Ph.D.





Updated at: 2020-12-10 08:43 UTC