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

processes.lisp



>Date: Fri, 25 Jun 1993 15:52:53 +0100
>To: MCL Bulletin Board <info-mcl@cambridge.apple.com>
>From: "Vincent Keunen" <keunen@montefiore.ulg.ac.be>
>X-Sender: vk@montefiore.ulg.ac.be
>Subject: processes.lisp
>
>There is no author name in the file...  Who wrote it?  It's great! 
>However, I am wondering how I can launch an app then *come back* to mcl
>immediately.  Ie something like (progn (select-applelink) (select-mcl)) ? 
>It does not work.  Anybody has an idea?

[...]

>Sorry guys,
>
>I asked too quickly.  It actually works but you have to insert a delay:
>(progn (select-applelink) (sleep 5) (select-mcl))
>
>I don't know why it is so...

I wrote "processes.lisp". Sorry I forgot to give myself credit.
You've got to wait until MCL is no longer the front process before
doing (select-mcl). Your 5 second delay will probably work for most apps,
but it would be better to wait for MCL to not be front-most first:

(defun ensure-application-active (creator)
  (if (find-process creator)
    t
    (let* ((foreground *foreground*)
           (filename (launch-creator creator)))
      (when (and filename foreground)
        (loop
          (event-dispatch)
          (unless *foreground* (return)))
        (select-mcl))
      filename)))