Regular FileMaker Script Triggers

Regular FileMaker script triggers fire at times that the FileMaker engine defines.  You are probably familiar with these, but if you aren’t I would recommend reading up them, here and here.  In short, they are over two dozen predefined events that FileMaker allows you to attach a script to. A common example might be the OnLayoutEnter script trigger that fires when ever the user arrives at a layout.

This is all good stuff, but what if you want to add your own Script Triggers?  Maybe you want to define a Script trigger that fires when ever another script reaches a certain point?  Thats what Virtual FileMaker Script triggers are for.

Virtual FileMaker Script Triggers

Virtual FileMaker Script Triggers fire when a script reaches a point that you define.  This lets you create scripts and features that are more portable and extendable. It fits in really well with the ModularFileMaker.org philosophy.  A quick simple example might be that you want a script to run a sort at certain point whenever it runs. But maybe the script needs to run on any layout, with any table. That means you can’t hard code the sort in your script. It might be different every time it runs.  What you need to is to be able to define a Script Trigger that fires “OnSort”.  That way each layout can have its own “OnSort” script that runs at the correct time.

Virtual FileMaker Script Triggers give you a way to do just that.

Go To Object

The trick is to use a Go To Object script step to trigger script that are attached to the Object.  Buttons make the best objects for this. You attach a script to a button’s “OnObjectEnter” or “OnObjectExit” script trigger. Then you trigger it by using a “Go To Object (ObjectName ) script step to “enter” the button button.  You can put that script step anywhere you like in your script.  When the script reaches that point it will trigger the script you setup on the button’s trigger. Presto “Virtual FileMaker Script Triggers” that you control!

If you want to use the OnObjectExit trigger, which can be useful in certain scenarios, you just use two Go To Object (ObjectName ) script steps; one to “enter” and another one to “exit”.

Check out the video and download the example file for the details on how this works.

Leave a Reply