10 Replies Latest reply on Apr 5, 2016 7:30 AM by DavidJondreau

    Install OnTimerScript Time Interval

    rtolliver

      I'm looking for recommendations for calculating a 14 day time Interval to be used with Install OnTimerScript.  I want to create a script that will run every 2 weeks.

        • 1. Re: Install OnTimerScript Time Interval
          DavidJondreau

          I'm not sure in OnTimer is what you want. The Filemaker client will need to be open for two weeks and that's unlikely.

           

          Are you using FileMaker Server?  What are you trying to accomplish in the "real world" here?

          • 2. Re: Install OnTimerScript Time Interval
            CarstenLevin

            By using OnTimer you would need a client (FileMaker Pro) on a PC or Mac with the same window open all the time.

            What is it you want to achieve. As David indicate, a Server Script may be the right solution.

            • 3. Re: Install OnTimerScript Time Interval
              rtolliver

              I have a dedicated Mac Mini (Main 1) running FM Pro 13 Advanced, with Peer to Peer Sharing turned On. The main DB is shared with 3 other clients.

               

              The objective for the timer is to run a specific report every 2 weeks or 4 weeks

              • 4. Re: Install OnTimerScript Time Interval
                CarstenLevin

                OK, then that is pretty easy, if you are sure that nobody will close the window in the meantime.

                 

                Let's say you want the script to run every 14 days. The OnTimer script step will run next time in the specified number of seconds.

                Thus the formula is X*60*60*24.

                You can of course also just write X*86400 (the number of seconds per day).

                 

                Check the File I am including here.

                 

                Best regards

                 

                Carsten

                 

                Ps. Also see the next post, which is maybe giving more of what you want.

                • 5. Re: Install OnTimerScript Time Interval
                  CarstenLevin

                  You may also want the script to run on a specific day at a specific time.

                  Let's say that your board want a weekly report on every Friday at 18.00 with the KPI's for this week.

                  You may want to give them a PDF or an Excel sheet with the result.

                   

                  Let your robot script (yes, it is a robot) create the PDF or the Excel sheet on you Mac/PC. Let the script send it by email to the recipients.

                   

                  The on timer script should probably have some extra parameters. Something like if

                  today = Friday

                  The current time > 18.00

                  The timestamp for last sent is not today

                  Then do it.

                   

                  And then you can let the onTimer script run every 10 minutes.

                   

                  This has the advantage that it will still run at the right time if you should have to close and open the window again.

                   

                  And you will also be able to add other if constructions to run other scrips/reports at other specified times from the same onTimer.

                   

                  Is this what you need?

                  • 6. Re: Install OnTimerScript Time Interval
                    bigtom

                    I do not think this is the best idea either. OnTimer can limit other scripts running, but if you can ensure a specific window is available and it is the active window it can work.

                    • 7. Re: Install OnTimerScript Time Interval
                      CarstenLevin

                      Hi Tom,

                       

                      I assume that the Peer2Peer server here are not in use as a work machine.

                       

                      Olliver write:

                      I have a dedicated Mac Mini (Main 1) running FM Pro 13 Advanced, with Peer to Peer Sharing turned On.

                       

                      So my main objection is NOT the robot running on this machine but the fact that they are not using a server to host the files.

                       

                      Backup will be nearly impossible with the database open all the time on the computer named "Main 1". You will need to close this Peer2Peer server and then take backups of the closed databases.

                      And running the files with a client as a server is also making them vulnerable.

                       

                      I would suggest a FileMaker Server 14. Also remember that you can get an AVLA agreement (license) from just one server.


                      Best regards

                       

                      Carsten

                       

                       

                      Ps. In my opinion P2P server should only be used for testing, and that is also not needed since you can get a test server for that purpose with a paid subscription here at the community.

                      • 8. Re: Install OnTimerScript Time Interval
                        bigtom

                        Carsten Levin wrote:

                         

                        Hi Tom,

                         

                        So my main objection is NOT the robot running on this machine but the fact that they are not using a server to host the files.

                         

                        Backup will be nearly impossible with the database open all the time on the computer named "Main 1". You will need to close this Peer2Peer server and then take backups of the closed databases.

                        And running the files with a client as a server is also making them vulnerable.

                         

                        I would suggest a FileMaker Server 14. Also remember that you can get an AVLA agreement (license) from just one server.

                         

                        Ps. In my opinion P2P server should only be used for testing, and that is also not needed since you can get a test server for that purpose with a paid subscription here at the community.

                        I fully agree. P2P is good for certain situations where you do not really care about the data or performance. I used it for a few months this way and then tried a trial of FMS. World of difference in speed and reliability.

                        • 9. Re: Install OnTimerScript Time Interval
                          RalphLearmont

                          If you are already using peer to peer in the way described, and are happy with it, there's going to be negligible additional overhead in having an OnTimer script set to run at such long intervals.

                           

                          The main concern, as others have mentioned, is to be aware that an OnTimer script is attached to a particular window, and if that window is closed for any reason, the planned triggered event will disappear.  It will therefore help if that window is "hidden" using the hide command.  It will still work whether or not it's the front-most window.

                           

                          If by chance another script is running when the trigger time comes, the triggered script will remain on hold until the the earlier script finishes. From that point on, the next "event" will be moved forward by whatever the delay happened to be.  If your plan involves running at an exact "Time of the Day", you can introduce a few extra steps (within the triggered script) - which sample the current timestamp, and calculate the time difference to the next planned runtime, and use that difference as the "interval".

                           

                          Ralph

                          • 10. Re: Install OnTimerScript Time Interval
                            DavidJondreau

                            What's a report? You mean you want to do a find for a certain group of records on a specific layout? And what happens to the "report" then? Do you want someone to look at it? Does the report get printed as a pdf and get e-mailed to the owner? Or saved to a folder somewhere? Why should this be automated rather than the person who needs the report clicks a button?

                             

                            You have a lot of options depending on the end result.  InstallOnTimer[] is one method for accomplishing this and not often a strong choice. For example, when a user logs in, you could check the date and account name and "run a report" when a specific user logs in on a specific date