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

Re: THINK Reference lookup from MCL

  The interface to Think Reference is pretty straight forward.  It
is documented in the "Online Help" database under "Think Reference

You simply send an event of class 'DanR' and id 'REF ' with the text
of the key word you want to lookup.  Copying a template is just as
easy (but of less utility since it is either a C or Pascal template
the is returned).

Of course you should use the process manager to quickly check if Think
Ref is already running and if not ask the Finder to launch it.

Although this code does not work (it is off the top of my head) it will
give you an idea of the strategy to apply.

(load ":examples:appleevent-toolkit.lisp")

(defun ae-put-parameter-text (the-desc the-key the-string)
  (with-macptrs ((my-pstring the-string))
    (format "~%string length ~S" (length the-string))
    (#_aeputparamptr  the-desc the-key :|TEXT| my-pstring (length the-string))))

(defun Think-Ref (search-string)
  (with-pstrs ((search-pstring search-string))
    (with-aedescs (event reply target)
      ;; set up the target
      (multiple-value-bind (psnhigh psnlow)
                           (find-process-with-signature :|DanR|)
        (if psnhigh
          (choose-appleevent-target target :prompt "Hi" :title "Title")
          (create-psn-target target psnhigh psnlow)))
      (create-appleevent event :|DanR| :|REF | target)
      (ae-put-parameter-text event :---- search-pstring)
      (send-appleevent event reply :reply-mode :no-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.]