[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Apple events from MCL to the finder
- To: email@example.com
- Subject: Apple events from MCL to the finder
- From: firstname.lastname@example.org (Mamdouh H. Ibrahim)
- Date: Thu, 3 Oct 91 17:15:06 EDT
In a previous message I asked for help with the Apple Events from MCL to the
Finder to do simple things such as empty the trash and show the clipboard.
Thanks for the help from the net, the code for these two simple apple
Now to make things a little bit complicated, I would like to send an
OpenSelection apple event to start Gofer from the utilities folder on my
disk named MSRC.
Accoreding to the Registry, I needed an alias for the folder and a list of
aliases for the selection.
Here is code I worte, that I feel very close to working, but not quite.
Any suggestions will be very much appreciated.
Mamdouh H. Ibrahim - Electronic Data Systems
Artificial Intelligence Services
5555 New King Street
P.O. Box 7019
Troy, MI 48007-7019
FAX: (313) 696-2325
; using appleevent-toolkit.lisp and the following high level functions
(defun put-parameter-descriptor (theEvent keyWord descriptor)
(ae-error (#_AEPutParamDesc theEvent keyWord descriptor)))
(defun put-parameter-pointer (theEvent keyWord codeType dataPointer dataSize)
(ae-error (#_AEPutParamPtr theEvent keyWord codeType dataPointer dataSize)))
(defun create-an-alias ( alias path)
(let ((namestring (mac-namestring path)))
(ccl::with-cstrs ((cname namestring))
(#_NewAliasMinimalFromFullPath (length namestring) cname
(%null-ptr) (%null-ptr) alias))) )
; Code that doesn't work most of it copied from the appleevent-toolkit.lisp
(with-aedescs (myevent target reply alias-list)
(choose-appleevent-target target )
(create-appleevent myevent :|FNDR| "sope" target )
;;create an alias for the folder and insert it as the direct parameter
(rlet ((alias :aliashandle))
(ccl::create-an-alias alias "MSRC:utilities:")
(with-dereferenced-handles ((aliasptr (%get-ptr alias)))
(put-parameter-pointer myevent "aedp" #$typeAlias aliasptr
(rref aliasptr aliasrecord.aliassize))))
;;create a list of the selection to open and insert it as the second param
(create-alias-list alias-list '( "MSRC:utilities:Gofer"))
(put-parameter-descriptor myevent "aesk" alias-list)
;;send the event
(send-appleevent myevent reply :reply-mode :wait-reply)) )
THe above gives me the following error message on the Listener
> Error: Data in an AppleEvent could not be read. (-1702)
> While executing: SEND-APPLEEVENT
> Type Command-. to abort.
However, if I change the keyword "aedp", which is the value I found in the
Registry for the DirectParameter, and replace it with the constant
#$keyDirectObject, the code looks as follows
(put-parameter-pointer myevent #$keyDirectObject #$typeAlias aliasptr)
Then I get the attention of the Finder as if it trying to do what I want
but it displays in a warning window the following
Sorry the original item could not be found.
Which indicates to me that my alias data is corrupt.
1) What is the correct value for the directparameter keyword?
2) What is wrong in the above code specifically with the creation of the alias?