How do I stop this thing?


Following on from yesterday's conversation let's consider that you have pressed a button to run a process. You find that the process is now taking a long time and you want to cancel. How do you stop it running?

There are standard FileMaker keyboard shortcuts to cancel a running script. On both Mac and Windows you can press the Esc key. On Mac, you can also use the keyboard combination Command+. (command-period).

These keyboard shortcuts only work if the user abort state is ON. If user abort is explicitly set to OFF, then the only way to stop a script is to crash out of the application or pull the plug on the client. Neither is a safe or desirable way to stop a process.

Abort on or off?

The argument for turning user abort off at the start of every script is that the user should never be able to stop a process once it starts running. While that seems reasonable in principle, the reality is that if the user cannot stop a script running, they are going to resort to pulling the plug.

The side note here is that most FileMaker users are unaware of the keyboard shortcuts to cancel a running script.

There may be cases where a script is misbehaving and really should be stopped. Imagine a script where a rare edge case causes a single record to be processed over and over again, creating new records in a table. While you may argue that this is the fault of the developer and that the script has not been tested properly, mistakes happen.

As discussed in previous emails my preferred programming habit is to only turn user abort off when it is explicitly necessary. One example is when showing the print dialog. If the user abort state is off and the user presses Cancel in the print dialog, then the script proceeds rather than presenting a choice to stop the entire script.

A process to stop them all?

So would it be useful if we wrote a scripted process to cancel any other script? Can we give the user the ability to invoke a script at any time? A panic button?

Unfortunately, FileMaker does not work that way. While a script is running, another script cannot simply interrupt and cancel it. That makes the decision about Allow User Abort an important part of designing every longer-running process.

Let's continue this discussion tomorrow.


Are you coming to Reconnect.Christchurch, 15-16 October?
Get all the details and purchase tickets at Reconnect.Christchurch.

Are you late to the ScriptLogic party? If you have missed out on some of these emails, catch up here: Email Archive

If you know someone else who you think might like this email, you can send them this link to subscribe: Subscribe to ScriptLogic Daily