Cabitaş Mühendislik Tic. Ltd. Şti.

Controlled Cancelling of FileMaker Scripts with “ESC” key

  • 13.03.2023
Claris FileMaker developers sometimes write long-running scripts to process data by looping through many records. In some cases, users may need to stop the process in the middle of its execution.

In such situations, what can we do?

  1. Allow User Abort in Claris FileMaker
    The "Allow User Abort" feature in Claris FileMaker allows users to cancel a process. This feature can be used anywhere in the scripts you write in Claris FileMaker, allowing users to stop the process at any time by pressing the "Command + Period" (Mac) or "Control + Period" (Windows) key combination.
  2. Adding a "Cancel" Button
    By adding a "Cancel" button to your process, you can give users the option to cancel the process at any stage. When this button is pressed, you can add the appropriate code to end the process.
  3. Using "Get(ActiveModifierKeys)"
    In Claris FileMaker, you can determine if the user is holding down the "Control" key or using another key combination to cancel the process with the "Get(ActiveModifierKeys)" function. This way, you can cancel the process when a specific key combination is pressed.
  4. Using the "OnTimer" Script
    In Claris FileMaker, the "OnTimer" script can be run as a script that repeats at a specific interval. This allows the script to end itself after a certain period of time when the user wants to cancel the process. This way, the process will not be completed without the user's permission.

Each of these methods allows users to safely cancel a process without causing unintended consequences. The method you choose may vary depending on your process and user experience goals.

In this article, we will discuss how Claris FileMaker scripts, especially those with long processing times, can be safely stopped using the "ESC" key. The method we will use will provide users with the ability to stop the script while also including methods to prevent potential inconsistencies in the unfinished process.

In Claris FileMaker, while a script is running, you can stop it by pressing the ESC key or the command + . (period) key combination. This feature is useful when the script is unexpectedly taking a long time to run or when it produces an unexpected result outside of the user's intention.

First, you need to decide what kind of behavior you want your scenario to allow. There are many places where you might need a script to run to completion. In such cases, you may want to turn off 'Allow User Abort' to prevent the user from canceling the script. This is a different use case and is outside the scope of this example. However, in cases where it is appropriate to cancel the script as long as you ensure that the clean-up happens in some way, the following example will be perfect for you.

This is a simple example, but you can easily expand it for any solution you have.

OnTimer Standing By

The essence of this solution is based on an OnTimer (Script Trigger) Script Trigger.

First, we initialize a global variable that indicates that we are in an 'Incomplete' state. Immediately after, we load an OnTimer Script Trigger. What OnTimer does is simply wait. And it keeps waiting. If this script is cancelled, the following cleanup script will be triggered. But the great thing is that OnTimer will not wait until the script is cancelled or ends - it will be executed in either case.

Clean Up

The most important part of the cleanup script is that it needs to immediately stop the OnTimer script trigger. Otherwise, it will enter an infinite loop.

The rest is quite simple. In the example, we show messages depending on the global variable. If the "$$_status" variable is "Incomplete," then the main script has been cancelled. But if it is "Complete," then the main script has successfully completed the task.

For a real solution, you can allow the user to return to a familiar layout and even delete some records if necessary. At this point, you're in charge, the developer.

For more information on how to control stopping scripts with "ESC" in FileMaker, watch the mini tutorial.

Follow our social media accounts and stay informed about our Mini FileMaker Trainings.

With Cabitaş Engineering Claris FileMaker trainings, become knowledgeable not only about how solutions are made, but also about why certain things are done. Learn about our organization-specific and general trainings. Join Cabitaş Engineering's FileMaker trainings and accelerate your company. If you want to get to know FileMaker or improve your FileMaker skills, attend our professional Claris FileMaker trainings. For detailed information about Claris FileMaker Education, please check out our FileMaker Education page.

As Cabitaş Engineering-Claris Turkey Solution Partner, we offer training, consulting, and custom FileMaker software development services on the Claris platform. In addition, with Cabitaş Engineering's solution partner structure, we bring you together with Claris solution partners according to your region or industry, offering you the most suitable solutions.

Do you need support? You can contact us via the communication form.

Gizem Çelik Profile Picture
Gizem Çelik

Yazılım Geliştirme Uzmanı Gizem Çelik, Selçuk Üniversitesi’nden Yüksek Bilgisayar Mühendisi olarak mezun oldu. 2014 yılında Cabitaş ekibine katıldı. Boş zamanlarında kitap okumayı, film izlemeyi ve yemek yapmayı sever.


Gizem’e sorduk: “Hangi ünlü tarihi kişi ile bir gün geçirmek isterdin?” 

“Prenses Diana ile. Girdiği ortamda dikkat çeken yüksek bir enerjisi var. Karizmatik aynı zamanda samimi buluyorum. İyiliksever biri olduğunu düşünüyorum ve iyilik için yaptıklarını taktir ediyorum. Düşüncelerini ağzından birebir duymayı ve onunla sıradan bir sohbet ortamında bulunmayı isterdim.” cevabını verdi. 

"Software Development SpecialistGizem Çelik graduated as a Computer Engineer from Selçuk University. She joined the Cabitaş team in 2014. In her free time, she enjoys reading books, watching movies, and cooking.

We asked Gizem: "Which famous historical person would you like to spend a day with?"

She said: "Princess Diana. She has a high energy that stands out in any setting. I also find her charismatic and friendly. I think she was a philanthropist and I admire the things she did for goodness. I would like to hear her thoughts firsthand and be in a casual conversation setting with her."

Controlled Cancelling of FileMaker Scripts with “ESC” key

Download link sent to your email address

This website uses cookies to improve your user experience.