6 Replies Latest reply on Feb 7, 2012 10:07 PM by Malcolm

    Halting a paused script from within a script.

    KylePutzier

      How can I Halt a paused script from a script initiated by a script trigger? I need a feature similar to a buttons "Current Script: Halt" option.

       

      Kyle

        • 1. Re: Halting a paused script from within a script.
          timwhisenant

          Hi Kyle,

           

          Halt actually stops all running scripts. I would think you need ExitScript.  After the pause step place an if statement like:

           

          If Get( ScriptResult) = 1

           

               Exit Script

           

          End IF

           

           

           

          Have the terminating button/script exit with a value and the if statement will evaluate and terminate the waiting script.

           

           

           

          Tim

          1 of 1 people found this helpful
          • 2. Re: Halting a paused script from within a script.
            KylePutzier

            Tim,

            I couldn't do it exactly like that. That portion of the program is a big sloppy mess. I could, however, set a global variable and test on that. It will work for me.

            Thank you,

            Kyle

            • 3. Re: Halting a paused script from within a script.
              timwhisenant

              Glad you got it worked out.

               

               

               

              Tim

              • 4. Re: Halting a paused script from within a script.
                RayCologon

                KylePutzier wrote:

                I need a feature similar to a buttons "Current Script: Halt" option.

                 

                Hi Kyle,

                 

                The  "Current Script: Halt" attribute in a button definition halts all currently running scripts when the button is clicked.

                 

                Including the Halt Script step at the conclusion of the triggered script will achieve the same thing.

                 

                Regards,

                Ray

                ------------------------------------------------

                R J Cologon, Ph.D.

                FileMaker Certified Developer

                Author, FileMaker Pro 10 Bible

                NightWing Enterprises, Melbourne, Australia

                http://www.nightwingenterprises.com

                ------------------------------------------------

                • 5. Re: Halting a paused script from within a script.
                  Vaughan

                  I usually approach this by splitting the script into two parts, at the point where you want to "halt" the process. Instead of halting the big script in the middle, decide whether to run the second script.

                   

                  So it changes from a problem of halting a running script (hard) to one of running another script (easy).

                  • 6. Re: Halting a paused script from within a script.
                    Malcolm

                    Doesn't everyone have a "pause" script?

                     

                    1. Create a script called "Pause". it only has to have one line "Pause []" but it's more powerful if you add an exit script line to pass results back to the calling script.
                    2. From within your big scripts, whenever you want to pause you do "Perform Script []" and specify the Pause script.
                    3. Now you can place buttons on the layout that Exit Script. One button may Exit[0] and another may be Exit[1]. Both will exit the paused script (which is the pause script) which returns control to your big script. If you do pass different script results you can test for them and change behaviours accordingly.

                     

                    The only drawback to having the application in a paused state is that it inhibits the menu items preventing the user from using them, so they can't use shortcut keys, etc. You need to provide UI elements which trigger scripts for all the actions that they may need.