Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!pikes!boulder!ncar!asuvax!mcdphx!udc!willcox
From: willcox@urbana.mcd.mot.com (David A Willcox)
Newsgroups: comp.sys.mac.hypercard
Subject: Intercepting Command-Dot
Message-ID: <1071@urbana.mcd.mot.com>
Date: 2 Oct 89 15:34:21 GMT
Reply-To: willcox@urbana.mcd.mot.com (David A Willcox)
Organization: Motorola Microcomputer Division, Urbana IL
Lines: 43

I've stumbled across what seems to be an undocumented feature of
HyperCard: If you type command-period while a HyperTalk script is
running, the script stops. 

That's real handy for stopping an errant script, and I suspect that a
lot of you out there already know about it.  (Sure wish I had know
about this a month ago when the only way I could think of to get out
of an runaway script was hit the old programmer's button.)

My question:  Is it possible to catch the command-dot as an event to
allow the script to do some cleaning up if it gets cancelled?  At the
very least, I'd like to get back to the starting card.  I'd also like to
let an XCMD clean up its memory.  For example, I'd like to be able to do
something like:

	on commandDot
	    if inScript then
		pop card
		myXcmd "cancelled"
	    endif
	    pass commandDot
	end commandDot

	on myFunction
	    push card
	    put true into inScript
	    myXcmd "start"
	    repeat forever
		go next card
		myXcmd "continue"
		
	    end repeat
	    myXcmd "done"
	    put false into inScript
	    pop card
	end myFunction

Any suggestions on how to do this?
--
David A. Willcox
Motorola Urbana Design Center	UUCP: ...!uiucuxc!udc!willcox
1101 E. University Ave.		INET: willcox@urbana.mcd.mot.com
Urbana, IL 61801		FONE: 217-384-8534