Stopping a Process

Mark Smith mark at maseurope.net
Tue May 6 19:37:54 EDT 2008


On 6 May 2008, at 23:50, RevList wrote:
> I have a routine that is looping through and opening a series of text
> files using a Repeat Loop.
>
> I know I can do a Command . to stop this, but what if I wanted to  
> let the
> end user stop the process?  How would I code this?
>
> Stewart
>

Another way, if you want ot have a 'stop' button, for instance, is to  
have a script local variable that you set from a button :

in the stack or card script that runs the loop:

local sStopLoop = false

on someFunction
    repeat until jobDone
      if sStopLoop then exit repeat
      doStuff...
      wait 0 millisecs with messages -- need this to allow rev to  
respond to button clicks
    end repeat
    cleanUpStuff...
end someFunction

on stopLoop
   put true into sStopLoop
end stopLoop

Then in the stop button script:

on mouseUp
   stopLoop
end mouseUp


Best,

Mark




More information about the use-livecode mailing list