Options For FileMaker Buttons Attached To Scripts

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit. For the best experience, please visit the journal directly by clicking (here). 

As you might guess, a majority of FileMaker scripts are activated by the click of a button on a layout. What many FileMaker users don’t know is that the button itself can affect the way the script performs. There are 4 options for a button that performs a script Halt, Exit, Resume and Pause. These options come into play when you are already in a script when the button is selected ( running or paused ).

You see, it’s possible you are within a paused script when you click the button! Yes, it’s possible to have a script activated but have it paused because you want some sort of interaction from the user. This can be things such as wanting the user to add data that the script is going to use in later steps, select a combination of buttons to perform first or any combination of the two.

Although I tend to look for the most straight forward and elegant solution in my scripting, there are times that I have a “rather hairy” combination of scripts in place for complex operations.


Here you can see the define button dialog box when a Perform script action is indicated and you can see the pop down list.


Again, here you can see the define button dialog box and I have selected the pop down list for how the script will perform when activated by the button.

Halt will stop the running script and any other scripts that called upon it ... before ... it executes the script attached to the button.

Exit will stop the currently running script but not any other scripts that called upon it ... before ... it executes the script attached to the button. After the script attached to the button is completely done, then the script that called upon the script that was running before the button was pushed will continue performing. ( confusing I know but I’ll include an example file to illustrate this !)

Resume will pause the current running script, run the script attached to the button and then automatically pick up the original script where it left off.

Pause will pause the currently running script and run the button script. When the script assigned to the button is finished, you will need to continue the original script ( via the continue button or the enter key ) or cancel the original script ( via the cancel button).

SO, HOW ABOUT A SAMPLE?
This is kind of an odd example of a rather odd FileMaker sub-feature. It involves the options of Halt, Exit, Resume and Pause options a button can perform during a current running script. That is to say that a script is running or paused when the button is selected. If that button is attached to the script ( what happens )? The 4 options help define that.

In the example, we have divided the 2 options into two main button docks. This is because the first set of buttons ( Resume and Pause ) are focused on the currently running script and the new button script.

The second two options ( Halt and Exit ) really come into play during a more complex cascading subscript situation. That would be when a script calls upon a subscript that is interrupted by a click of a button.

To test the Resume button - click the button Count To Ten - then around number 5 - click the Resume button. You will see that the colors of red, blue, green, orange appear and then the count up to ten proceeds.

To test the Pause button - click the button Count To Ten - then around number 5 - click the Pause button. You will see that the colors of red, blue, green, orange appear and then the script is paused, clicking the continue button ( or the enter key ) will resume count up to ten.

To test the Halt button - click the button Count To Ten With Color Sub - then around number 4 you will see the countdown switch to colors - when this happens click the Halt button. You will see that the seasons of the year show up ( Spring, Summer, Fall and Winter ) and then all scripts stops completely.

To test the Exit button - click the button Count To Ten With Color Sub - then around number 4 you will see the countdown switch to colors - when this happens click the Exit button. You will see that the seasons of the year show up ( Spring, Summer, Fall and Winter ) and then you will see the countdown continue towards 10. You will note the colors subscript did not continue performing.

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.