6 Replies Latest reply on Sep 6, 2012 1:44 PM by Sorbsbuster

    On Timer Script OMG!

    AndyCohen

      Title

      On Timer Script OMG!

      Post

      I appologize if someone already gushed about this... I looked everywhere on this forum and could not find anything...

       

      The new "On Timer Script" script command.... WOW!   

      At first glance no big deal...  it's a timer which fires off another script given a timer interval...   BUT when I tried to use it I find that this command is actually as profound an addition as script triggers are...

      After you invoke it, it does not pause, nor does it stop anything else from happening... in essense FM Inc has given us the ability to do things without loops! Yet still quite controllable...i.e., interruptable.

      My current app uses it to fire off a timer which the user needs to calc secs during an execrise routine...   While it's doing the timing the user can still do whatever they want within the app and the timer does it's thing... until they stop it...

      FilemakerPro 10 is a fully event driven, contextual relational database in a league of it's own.

      ACK!!! FM INC YOU ROCK!!! 

      I promise lots of segments in the podcast about this new jewel!

        • 1. Re: On Timer Script OMG!
          cmspe

          I've been looking for a way to create a stopwatch/timer to add to my database for my PE classes.  I want to be able to create a stopwatch that will time my students and then link the times to my students.  How would I go about creating a layout that would be a timer that would create a list of times that could be inserted into the students' run fields?  Right now I use a separate stopwatch app and then have to write all the times next to the students on paper and then type that score into their run fields.

          • 2. Re: On Timer Script OMG!
            philmodjunk

            Define two time fields, startTime and EndTime.

            Add two buttons on your layout and give them the following steps:

            Set Field [YourTable::StartTime ; Get ( CurrentTime ) ]

            Set Field [YourTable::EndTime ; get ( CurrentTime ) ]

            Use the first button to start the "stop watch" and the second to stop it.

            Define a calculation field as EndTime - StartTime to compute the elapsed time. You can format the return value of this field as number to get the elapsed time in seconds or you can specify a time result to get a minutes::Seconds format. (You can format the time result on your layout using the data tab of the inspector.)

            The key limitation here is that FileMaker measures time to the nearest second and this may not be precise enough for your needs if you want time to the nearest 10th of a second.

            • 3. Re: On Timer Script OMG!
              cmspe

              I have successfully created a stopwatch for my PE classes.  Thank you for your post.  I know this was a long time ago, but I was just able to get to it this year.  I do have one issue with the stopwatch.  I'll have times where multiple students are crossing the finish line very close together.  That means I'll have to press the button very quickly.  This causes the iPad to zoom in and messes with the stopwatch.  Is there any way to disable the double tap zoom feature while on this layout?

              • 4. Re: On Timer Script OMG!
                Sorbsbuster

                I have an issue with OnTimer Script step.  The FM Help suggests that the firing of one timer script is stopped by the firing of another.  To say that sounds like a designer's nightmare to me is an understatement.  I did have 5 or 6 paragraphs of examples and explanation typed, but for the 3rd time today my 'Comment could not be posted', so I have given up.  I would sleep easier in my bed (and share the enthusiasm for this added script function) if I could be assured that I have completely mis-read the Help, and that firing a second script doesn't stop (even worse; SILENTLY stop?) the previously-running script.

                So, you have a list view of Participants, and you click on the first one to start the stopwatch.  Then you click on the second participant to start their stopwatch.  Which stops the first stopwatch counting?

                I have read the Help again, and the specific example if gives is to stop the first timer by specifying another Install Timer Script step but with no script specified.  So, if I start an Install Timer Script step but with a script specified, it does not stop the first one?  I'm curious to know how I would specify that a 'Stop' script button would stop the counter for Participant 2, and not Participant 1.

                • 5. Re: On Timer Script OMG!
                  cmspe

                  I'm not using the OnTimer Script step for my stopwatch. See the comment by PhilModJunk above my previous post to see how I created my stopwatch.

                  • 6. Re: On Timer Script OMG!
                    Sorbsbuster

                    I understand that.  I am only trying to raise a point that (unless I have completely misinterpreted the Help, and I hope I have) the OnTimer script step can only run one script at a time.  We thought of using the script step to run integrity checks, back-ups, etc. and got goosebumps when we thought of, some time down the line, someone thinking it was a great idea to use On Timer Install to start some trivial little script step.  So we've stuck to Old Skool system-scheduled FM Trigger Files.  Everyone understands them and they are rock-solid reliable.

                    I used the example of Event Participants to suggest a scenario where within seconds someone may want to start simultaneous timed scripts  running.  If the example doesn't appeal: no matter.  We used the script step to run scheduled backups.  Then we liked it so much we thought of using it to do 'Late Order Checks'.  Then we thought that a trivial 'Late Order' check would actually stop the back-up running.  So we backed out of that one quite quickly, wondering what would have happened if...?

                    As always, I am very happy to be shown to have misunderstood.