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

Re: Executing Applescripts from MCL



Excerpts from netnews.comp.lang.lisp.mcl: 29-Apr-94 Executing
Applescripts from.. by Shannon V Spires@somnet. 
> 1. Has anybody written CreateObjSpecifier in MCL? It's not in
> the Appleevents interface file, so I assume it's not in ROM.
> This function would make it easier to send non-trivial events
> to other applications from MCL when AppleScript is not
> installed.
> 

Here's mine:

(defconstant $keyAEDesiredClass :|want|)
(defconstant $keyAEContainer :|from|)
(defconstant $keyAEKeyForm :|form|)
(defconstant $keyAEKeyData :|seld|)

;;;create-obj-specifier duplicates the functionality of CreateObjSpecifier
;;;DisposeInputs is always false
(defun create-obj-specifier (desired-class container keyform keydatadesc
objspec)
  (declare (type aedesc container keydatadesc)
           (type desctype desired-class keyform))
  (with-aedescs (list-spec class-desc form-desc)
    (%stack-block ((classtype 4)
                   (formtype 4))
      (setf (%get-ostype classtype) desired-class)
      (setf (%get-ostype formtype) keyform)
      (ae-error (#_AECreateList (%null-ptr) 0 t list-spec))  ;create
objspec as a list
      (ae-error (#_AECreateDesc #$typeType classtype 4 class-desc))
      (ae-error (#_AECreateDesc #$typeEnumerated formtype 4 form-desc))
      (ae-error (#_AEPutParamDesc list-spec $keyAEDesiredClass class-desc))
      (ae-error (#_AEPutParamDesc list-spec $keyAEContainer container))
      (ae-error (#_AEPutParamDesc list-spec $keyAEKeyForm form-desc))
      (ae-error (#_AEPutParamDesc list-spec $keyAEKeyData keydatadesc)) 
      (ae-error (#_AECoerceDesc list-spec $typeObjectSpecifier objspec)))))