3 Replies Latest reply on Oct 25, 2013 9:01 AM by philmodjunk

    Can time between button clicks be monitored before resuming script?

    shae1725

      Title

      Can time between button clicks be monitored before resuming script?

      Post

           Are there any options available to hold a script if a button is being pressed faster than the script can run?

           I have a  button which adds in increments of 1 to a field. every time its pressed a script is triggerd. The script can take a couple of seconds to complete. this causes problems as sometimes you might need to click the button a few times and I don't want to have to wait for the script to complete.

           I thought there might be a way of the script holding back a few milliseconds to monitor for more button clicks. then resuming if none.

           Any ideas

            

            

        • 1. Re: Can time between button clicks be monitored before resuming script?
          philmodjunk

               Simply incrementing a field should happen very quickly. It really shouldn't take a couple of seconds to complete.

               But you might split your script into two scripts:

               Script 1:

               Set Variable [$$increment ; value: $$Increment + 1]
               Install OnTimerScript ["Script 2" ; 3 ] ---> set a short interval in seconds, you may need to experiment to get the best interval

               Script 2:

               Allow User abort [off]
               Install OnTimerScript []----> cancels the timer so that this happens only once
               Set field [YourTable::Field ; YourTable::Field + $$Increment ]
               Set Variable [$$Increment ; value: "" ]
               #The rest of your script goes here

               Note only one "timer" can be set on any given FileMaker window so repeated, rapid taps/clicks of the button for script 1 will keep resetting the timer until the user stops tapping, then the time can run down and perform script 2 where an Install OnTimer Script step with no parameters cancels the timer so that script 2 only runs a single time in each time the button is clicked/tapped in this fashion.
                

          • 2. Re: Can time between button clicks be monitored before resuming script?
            shae1725

                 Hi Phil

                 Will try that.

                 When you say only one timer can be set, do you mean at the same time or only 1 in the window?

                 if I had another timer in say script B, would a timer installed in Script A trigger at the same time Script B is triggerd?

                  

            • 3. Re: Can time between button clicks be monitored before resuming script?
              philmodjunk
                   

                        only one "timer" can be set on any given FileMaker window

                   It's one timer for each window. When you set a new timer on the same window, it replaces any previous timer--which is required in order for my suggested script to work here.