1 Reply Latest reply on Mar 16, 2012 2:05 PM by PalmDBS

    Problem with Install Ontimer script


      Here iare two scripts that I set up to run at 9:00 pm daily:


      If [ Get(HostName)="Harriet" ] Install OnTimer Script [ “Imported all Records”; Interval: GetAsNumber ( Time ( 21 ; 0 ; 0 ) ) - GetAsNumber ( Get ( CurrentTime ) ) ] //Harriet is the name of my Server


      Here is the script "Imported all Records"


      Perform Script [ “Import Drivers” ]

      Perform Script [ “Import Addresses” ]

      Perform Script [ “Import Passengers” ]

      Perform Script [ “Import Schedule” ]

      Set Field [ Schedule::g.backupCounter; Schedule::g.backupCounter+1 ]

      Set Field [ Schedule::g.backupCounterTime; Get ( CurrentTimeStamp ) ]


      Here's the problem:


      The script runs more than once. The first time it ran over 30 times.

      Even more confusing is the time stamp had a time of 10:38

      The second day it ran multiple times and was timestamped at around 3:00 in the afternoon.


      Any thoughts would be appreciated.

        • 1. Re: Problem with Install Ontimer script

          Install Ontimer is not the same as a scheduled script.  Whatever you define the interval as (say 600), it will run every 600 seconds (10 minutes).  The calculation that you have in place, if run at 8:55pm, will actualy instruct FileMaker to run the script every 5 minutes while the current window is open.  Furthermore, the timer is replicated in new windows.  So if your scripts open new windows, the timer is replicated in those windows until those windows close. To turn off the timer in the new window, run a blank install ontimer command right after the window is opened.


          Do you have access to the FileMaker server to create a truly scheduled script there?  If not, this article may be of help... http://forums.filemaker.com/posts/48858e2c82  Shows how you can use install ontimer to continually compare to the current time, then run a script if the time creteria is met.  I would then set a global variable for the last date it ran.  Then in your scripting, if the current time is past 9pm and last run date was greater than 9pm today, do nothing - otherwise run the script.


          Install ontimer reference: http://www.filemaker.com/11help/html/scripts_ref1.36.16.html