BlogFileMaker

FileMaker OnTimer Examples

By May 29, 2009 7 Comments

Introduction

Do you like to keep your meetings short and sweet? Create a meeting timer as a reminder of when it’s time to wrap up. Do you keep appointments in a FileMaker database? Add a reminder feature to stay on top of things.

These examples illustrate two uses of the script step Install OnTimer Script, new in FileMaker Pro 10. Download the demo file and let’s take a look.

Download the OnTimer Example File – ZIP

Meeting Timer

The meeting timer has two displays: a progress bar and a countdown timer. Each is updated by the “Increment Timer” script. This script is called every 30 seconds after the file is opened, when the “OnOpen” script is called. The OnOpen script uses the new script step, Install OnTimer Script. That is the concept behind this new feature: create a script you’d like to call at a specific interval, then trigger it with a separate script that includes Install OnTimer Script.

The countdown display is set to the remaining time, based on the difference between the current time stamp and the meeting end time. The progress bar below the timer is a small web viewer that displays a colored table set to a width corresponding to the time transpired.

Appointment Reminder

The appointment reminder displays a custom dialog as a reminder of upcoming appointments. Click on an appointment in the list to view its reminder preferences.

The timer for the appointment reminder is started when its window is opened. I’ve added this to the Navigate script so that the timer only runs when it is needed.

Some notes about Install OnTimer Script

You can only “install” one timer per window, so if you want to run more than one automated process with a timer, either include them in the same script, or use multiple windows. In this demo I have set up a separate timer for each example, which is why I have the Appointment Reminder layout open in a new window. This way the two timers can run independently.

To stop a timer, either close the window in which it is running, or call the Install OnTimer Script step without specifying an interval.

And that’s it! Dig inside the scripts to learn how I’ve set this up so you can incorporate the ideas into your own solutions. And, feel free to post questions here if you get stuck.

Brent Durland

Brent Durland

Brent is a certified FileMaker developer since version 7 and has been developing with FileMaker Pro since 1997. When he’s not building desktop and web applications, he’s either in the backyard building playhouses for his four daughters or in the basement recording music with them.

7 Comments

  • Avatar thong says:

    How can I set up the Seconds in the time remaining?
    thanks.

  • Avatar Edward Souza says:

    Dear Mr. Durland,

    thank you for the post and example file; they both clarify an otherwise obscure subject. my sincere gratitude.

  • Avatar joey rey says:

    Dear Sir,

    How can I modify this to be as an ELAPSED TIMER, instead of as a COUNTDOWN.

    thanks and would greatly appreciate your reply.

  • Avatar Woo says:

    Hi,
    I need help on building a score board that has multiple count down clock that goes 0 similar to hockey penalty clock.

    I did came up with two sample count down clock but canΓÇÖt get to run at same time. When second clock starts the first one stops. I do I use OnTimer to do this?

    Can you help

    Woo

  • Avatar Rodrigo Guzman says:

    How can you do it with the Solution on the Server when the Solution its not running?

    • Wim Decorte Wim Decorte says:

      Hi Rodrigo,
      We’d have to know more about exactly the scenario is that you are trying to cover. If the solution is on FileMaker Server but not actually opened and hosted by FileMaker Server then no users can be in the file. The OnTimer is executed by FileMaker Pro so it requires that the file is opened by a user.

Leave a Reply