[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Free from appleEvents pr
- Subject: Free from appleEvents pr
- From: "Andre Koehorst" <andre_koehorst@riks.nl>
- Date: 30 Jun 93 11:58:09 U
Reply to: RE>Free from appleEvents proce
Vincent Keunen wrote
> What I'd like is to send the request and *always* return
> *immediately* to HC.
...
> I probably need :
>
> - a way to send an AE that does not wait for the reply;
I've had similar problems, caused by sending scripts to hypercard from the code
requested from hypercard. (Huh?)
I solved this by wrapping eval-enqueue around the code called from hypercard.
This returns to Hypercard directly, then processes the code in lisp. So even
if the code does not return (for whatever reason) you can go on in Hypercard
immediately.
I've distilled the following code from what I use:
TWO HANDLERS TO BE PUT INTO HYPERCARD:
on sendToMcl theRequest
-- Note the quote, it is put in because eval-enqueue evaluates it's arguments
request "(process-hypercard-request" && "'" & theRequest & ")" from program
"MCL"
end sendToMcl
on test
-- Building the calls can be tricky
sendToMCL "(dotimes (n 1000) (format t " & QUOTE & "~%looped ~a times" &
QUOTE & "n))"
end test
THE FUNCTION TO BE EVALUATED IN LISP
(defun process-hypercard-request (the-request)
(eval-enqueue the-request))
Now call test from the message box in hypercard andsee what happens.
> - a way to send an AE and return to the sender even if there are problems
> sending the event;
> - a way in MCL to catch all errors (for that, a handler-case on error would
> suffice, I guess - that I can do);
> - a way to detect programmatically that a lisp program is stuck or looping
> (a timeout could be enough, I guess);
No ideas, but would be interested in any responses.
Hope this is of any help,
Andre Koehorst