Button to stop a repeating script?

Scott Rossi scott at tactilemedia.com
Mon Sep 29 19:09:11 EDT 2008


Recently, Michael wrote:

> I have a Start button that starts an indefinite repeat. (It downloads a bit
> of information from a web site and sends an email, waiting 5 minutes until
> doing it again.) I would like a Stop button to stop the repeat, but all I
> can do is Cmd-. to abort it. I tried setting a global flag but that doesn't
> work, at least the way I'm doing it. Ideas?

If you use "send in..." for your looping mechanism, you can cancel the ID of
the message that is set to loop.  Something like:


# THE MAIN LOOPING MECHANISM
on customEventLoop
  # DOWNLOAD ACTION
  # EMAIL ACTION
  send " customEventLoop" to me in 300 seconds
end customEventLoop


# IN A CANCEL BUTTON
on mouseUp
  cancel item 1 of line lineOffset(" customEventLoop",pendingMessages()) \
      of pendingMessages()
end mouseUp


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list