6 Replies Latest reply on Aug 15, 2013 8:30 AM by TomPingel

    Install on Timer Script Behavior

    TomPingel

      Title

      Install on Timer Script Behavior

      Post


           What happens when a script scheduled by 'Install on Timer Script' was scheduled to run and the computer is sleeping when the scheduled time comes?  Does the counter pause the countdown when the computer is put to sleep and then resume when the computer 'wakes up' and run sometime later? Does the script run immediately upon wakeup?  Or is the running of the script canceled?

            

           What happens if FM is exited while a script is scheduled? Is the script still scheduled when that FM solution is run again?Does it behave the same as if the computer were put to sleep?

        • 1. Re: Install on Timer Script Behavior
          philmodjunk
               

                    What happens when a script scheduled by 'Install on Timer Script' was scheduled to run and the computer is sleeping

               Don't know. Perhaps you could experiment and find out?

               

                    What happens if FM is exited while a script is scheduled?

               Each "timer" is set to a specific FileMaker window. When that window closes, the timer is canceled out. Inistall OnTimer with no parameters will also cancel the timer in the current window.

          • 2. Re: Install on Timer Script Behavior
            TomPingel

                 Experimenting would be a whole lot easier if there were somewhere to see the timer schedule for what's in queue. Just when I think I understand how it works, it throws me a curve.

            • 3. Re: Install on Timer Script Behavior
              philmodjunk

                   As a test, I'd set the timer script to create a new record in a table, then define a timestamp field that auto-enters the creation timestamp. Then fire off the script that installs the timer, walk away and let the inactivity allow your machine to sleep, return and wak it up, wait longer than the interval specified by InstallOnTimerScript and then examine the records in a table view to see how many records were created and whether any were created after hibernation and after being awakened. I suspect that none will be created while the computer is sleeping.

              • 4. Re: Install on Timer Script Behavior
                TomPingel

                     Well, near as I can tell, when you install a timer script, the system does a countdown to execution.

                     So if you specify 600 seconds (10 minutes) and the computer goes to sleep at minute 1 and wakes up at minute 6, the script won't run until minute 15, not minute 10. The computer needs to be 'active' for 600 seconds.

                     Likewise, if the computer went to sleep at minute 8 and woke up at  minute 12, the script would run at minute 14, not as soon as the computer wakes up.

                     For my application, the scripts are delayed 8, 12, or 24 hours before running again, but there is an urgency to run them as soon as possible. Since this occurs infrequently, and is not an everyday event, it is not unlikely that the user will inadvertently close the lid on their laptop overnight, or forget to turn off the energy saver on their computer for this cycle. This will delay the desired executions of the script.  When the user pops the computer open in the morning they may have lost 6,8, or more hours of 'countdown'. The timer needs to be reset when the computer has been asleep to compensate for the time the computer was asleep.

                     So my problem is how to detect that the computer was asleep and for how long - without introducing significant overhead. I'm working on that now. Any suggestions?

                • 5. Re: Install on Timer Script Behavior
                  philmodjunk

                       IF this is a hosted file, take a look at whether or not you can use a server schedule for this so that this takes place on the server, not a client machine. That, in turn, will completely avoid the issue.

                       Only other thing I can think of is a Timer with a much shorter interval--say every 5 minutes or so that checks a timestamp field or global variable to compare to the current timestamp to see when enough time has elapsed that the timer controlled script should be performed.

                  • 6. Re: Install on Timer Script Behavior
                    TomPingel

                         It's not hosted.

                         I like the last suggestion. Thanks!