[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re2: THINK Reference lookup from MCL
- To: Dave@Yost.COM, info-mcl@cambridge.apple.com
- Subject: Re2: THINK Reference lookup from MCL
- From: jbk@world.std.com (Jeffrey B Kane)
- Date: Wed, 1 Dec 1993 12:56:21 -0500
Here is some code that actually runs. Hope it helps you.
Jeffrey
(load ":examples:appleevent-toolkit")
(defun strlen (cstring)
"count the number of chars in a zero terminated string. Returns the length
or nil if you don't pass a macptr to the function"
(if (macptrp cstring)
(let ((n 0))
(loop
(if (= (%get-byte cstring n) 0)
(return n)
(incf n))))
nil))
(defun Think-Ref (search-string)
(with-aedescs (ae target reply)
(with-cstrs ((my-cstring search-string))
(multiple-value-bind (psnhigh psnlow)
(find-process-with-signature :|DanR|)
(if psnhigh
(create-psn-target target psnhigh psnlow)
(progn
(message-dialog "Please launch Think Reference")
(break "Abort - Think Reference not running")
;; you could send a command to the finder to open Think Ref here
)))
;; create an apple event
(ae-error (#_AECreateAppleEvent
:|DanR|
:|REF |
target
#$kAutoGenerateReturnID
#$kAnyTransactionID
ae))
;; stuff it with our parameters
(ae-error (#_aeputparamptr
ae
:|----|
:|TEXT|
my-cstring
(strlen my-cstring)))
;; send it off
(send-appleevent ae reply :reply-mode :wait-reply))))
(Think-Ref "WaitNextEvent")
======================================
Jeffrey Kane, MD
Kane Biomedical Systems
Boston, MA
Internet jbk@world.std.com
Compuserve 74206,640
AppleLink D0738
[Don't take life too seriously... it's not like anyone gets out of it alive.]