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

Re: I'm trying to have lisp launch an application (its not working)



>To do this I'm attempting to use the applevents toolkit and the Open
>Selection applevent for the finder. I've written:
>
>(require 'appleevent-toolkit)
>
>(defconstant $kAEOpenSelection :|sope|)
>(defconstant $kAEFinderEvents :|FNDR|)
>(defconstant $keySelection :|fsel|)
>
>(defun create-alias-record (the-desc path)
>  (rlet ((alias :aliashandle))
>    (let ((namestring (mac-namestring path)))
>      (rlet ((fsspec :fsspec))
>        (with-pstrs ((name namestring))
>          (#_fsmakefsspec -1 -1 name fsspec))
>	(#_NewAlias (%null-ptr) fsspec alias))
>      (with-dereferenced-handles ((aliasptr (%get-ptr alias)))
>        (#_AECreatedesc #$typeAlias aliasptr (rref aliasptr aliasrecord.aliassize)  the-desc)
>        (#_DisposHandle :check-error (%get-ptr alias))
>        ))
>  the-desc))
>


This may be way off base but I wrote a quick launcher that works with
processes!  It took all of 2 minutes to write, and was used once, so
beware!

(defun launch (&optional pathname)
  (if (not pathname) (setf pathname (mac-namestring (choose-file-dialog
))))
  (rlet ((fsspec :fsspec)
         (pb :launchparamblockrec
             :launchBlockId #$extendedBlock
             :launchEPBLength #$extendedBlockLen
             :LAUNCHFILEFLAGS #$launchNoFileFlags
             :launchcontrolflags #$launchContinue
             :launchAppSpec fsspec)
         (fname :str255))
    (%put-string fname pathname)
    (#_FSMakeFSSpec  0 0 fname fsspec)
    (#_LaunchApplication pb)))

John Louch
jlouch@apple.com
John Louch
jlouch@apple.com
jlouch@gateway.qm.apple.com
jlouch@polyslo.csc.calpoly.edu
(load "ccl:interfaces;processes")
(defun launch (&optional pathname)
  (if (not pathname) (setf pathname (mac-namestring (choose-file-dialog
))))
  (rlet ((fsspec :fsspec)
         (pb :launchparamblockrec
             :launchBlockId #$extendedBlock
             :launchEPBLength #$extendedBlockLen
             :LAUNCHFILEFLAGS #$launchNoFileFlags
             :launchcontrolflags #$launchContinue
             :launchAppSpec fsspec)
         (fname :str255))
    (%put-string fname pathname)
    (#_FSMakeFSSpec  0 0 fname fsspec)
    (#_LaunchApplication pb)))