5 Replies Latest reply on Nov 29, 2013 11:57 AM by philmodjunk

    pause and resume a script with a single button

    shae1725

      Title

      pause and resume a script with a single button

      Post

           I have a button which I want to pause a script with first click and on second resume.

           I can pause and resume with single buttons ok but confused as how to write a script to do both!

           Also is there a function that can call the status of  script(A) as I would like different script(B)  to exit if Script(A) paused

           Any help would be appreciated

            

        • 1. Re: pause and resume a script with a single button
          philmodjunk

               Have your script toggle the value of a global variable each time it is run. Use the value in the variable to determine whether or not to pause the script.

               If [ Note $$Resume ]
                  Pause/Resume [Indefinitely]
               End If
               Set Variable [$$Resume ; Value: Not $$Resume ]

               And make sure to select the "resume" button option when selecting this as the script to be performed.

               There isn't any way to check the status of another script that I know of. What exactly are you trying to do with this combination of buttons and scripts? Perhaps there is an alternative approach that can be used.

          • 2. Re: pause and resume a script with a single button
            shae1725

                 Hi Phil

                  

                 What I attempting is a Play/ Pause Button like on a smartphone!

                 the button will have a "play icon" when script inactive and when pressed the "pause icon" will appear indicating the script is running.

                 I'm using it to go through the horizontal portal project I'm building.

                  

                 The reason I'm asking about the status is if the script gets stopped on the FM toolbar the button will not show correct status nor will the variable be correct.

            • 3. Re: pause and resume a script with a single button
              philmodjunk

                   Yes but what are all of these scripts supposed to do when they run besides the pause/resume? What is being "played"? What is the "other script" that should be exited if this script is paused?

                   One possible trick: Halt Script  when used as a step in a script will both halt the current script and also halt all other scripts.

              • 4. Re: pause and resume a script with a single button
                shae1725

                     Will investigate the Halt Script as I never used before.

                     Just out of interest I have a timer in my script, Is it possible to directly set a field to count down or up?  I could then build a funky progress bar with GraphicsMagick

                      

                     Will post a screen capture of the script when I tidy it up as its very messy

                • 5. Re: pause and resume a script with a single button
                  philmodjunk

                       A general description of what you want to accomplish would be good.

                       Install OnTimerScript could be set on a window to periodically update a field to produce a field that counts up. And a second use of Install OnTimerScript with no parameters specified can be used to "clear" a timer so that it stops executing every x seconds.

                       And while it's a bit of a challenge, I have been able to use Install OnTimerScript with a 1 second interval as a way to detect an iOS phone's orientation and select the layout appropriate for the portrait or landscape orientation that is current at the moment...