sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Exit a script before it completes

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 415 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      Garry K
      last edited by

      We have a script that will take quite a while to run.
      What is the generally accepted way to stop the script in the middle of processing?

      Can I add a menu option that sets a variable? Or will sketchup run a second script while still running the first one?

      I suppose I can throw a dummy sentinel (trigger) file into a location and check for the existance of the file at the end of each loop.

      In this case each loop will take 10 to 20 seconds and we have 50 thousand loops.

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        are you wanting to abort the process or suspend, do something, resume?

        In the loop itself you can add a timer and test for a key down...

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          The UI isn't given any chance of interrupting. Ruby runs in the main thread and blocks everything.

          What is the purpose of the cancellation? For the user or as you as developer?
          I some times add a debug-timeout where my loops will break out of the operation. Though, if it's a method call to the API you are out of luck as you have no access to interrupt it's processing.

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • G Offline
            Garry K
            last edited by

            My client wants to be able to stop the process. I've got him copying a file named stop.txt into a folder. I check it every loop. Works great.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement