how to terminate a script

 From:  Michael Gibson
10847.4 In reply to 10847.3 
Hi Peer,

re:
> First, how can I avoid the infinite loop that results if a script is set to repeat, but the script throws
> an alert and then exits as soon as the alert button is clicked?

That's a bug in that script, it should disable the repeat checkbox which is done by setting:
// config: norepeat
at the top of the .js script file. I've updated the script to have that now so you shouldn't run into this with the updated version.

The repeat checkbox is primarily meant for use with drawing commands and not ones that do selection.

You can still repeat a command that does selection by right clicking in the viewport or pushing the Enter key while in selection mode. If you only need to repeat things sometimes it's easier to use to use right click to do it, the repeat checkbox is for stuff like you're going to draw a whole bunch of points or lines.


> and had to force quit MoI while I had unsaved work on a project that I cared about. Now I'm leary
> of ticking the Repeat checkbox for any script, even though it would be handy to use repeat sometimes.

Sorry you ran into this data loss. If you run into this kind of loop again you can recover your file by triggering a crash.
To do that find the pid for the MoI process in Activity Monitor and from a Terminal prompt do:

kill -s SIGSEGV pid_number_here

That should cause MoI to trigger the crash dialog where you can save your file.


> Second, how can I safely re-prompt a user for input?

I'll take a look at this part in a bit.

- Michael