Allow User Abort In FileMaker Scripts

From Dwayne Wright PMP - Certified FileMaker Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

FileMaker  has  a  keyboard  shortcut  for  both  Macintosh  and  Windows  machines  to  get  you  out  of  a  running  script.  These keyboard shortcuts are the esc (escape) key for Windows users and command-period key combination for Macintosh users. The problem with this can be that the integrity  of  the  database  can  be  damaged  if  a  script  is  not  allowed  to  run  it's  complete  course.

For example, scripts that pause for user interaction, like entering in key data, if aborted cold result in data integrity within the file being harmed if is the script is not allowed to fully carry out its task.

A developers setting of the  Allow  User  Abort  script  step  will either  allow  or  not  allow  the  end  user  to  cancel  out  of  a  running script.  The   I think it is safe to say that Allow User Abort  is  one  of  the  more  important  script  steps  for a highly controlled scripted operation.  Normally,  you  will  want  to  have  this  script  step  as  close  to  the  top  of  the  script  as  possible.  Otherwise  the  user  could  abort  the  script  before  the  script  comes  to  the  Allow  User  Abort  step  is  reached  in  the  script.

FYI... If  you  have  a  script with an exceptionally long execution duration that should NOT be aborted,  do a solid for your users and warn  them  first.  The  best  way  to  do  this  is  using  another  FileMaker  script  step  called  Show  Custom Dialog Message.  You  can  warn  the  user  that  the  script  may  take  a  long  time  to  run  and  allow  them  to  abort  its  execution  BEFORE  it  gets  started.


This  example file  uses  a  scripted  Find  operation  to  show  you  the  reason  you  may  want  to  include  the  Allow  User  Abort  [off]  step  in  your  scripts.  The  script  goes  to  a  different  layout  and  puts  the  user  into  find  mode.  Then  the  user  enters  in  their  find  criteria  and  clicks  the  perform  find  button.    

There  are  a  number  of  things  missing  from  this  operation  but  I  want  to  focus  on  the  Allow  User  Abort  script  step. In particular, I want to illustrate the problems your users may encounter. You  will  notice  the  script  without  user  abort  will  show  a  cancel  button  on  failed  searches.  This  can  strand  a  user  on  the  find  layout  and  may  not  allow  a  way  back  to  the  entry  layout. 

An example file can be downloaded by clicking (here)
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.