This tip demonstrates how to trigger a script execution on tab change event in FileMaker.
Step1: Give “object name” to all your tabs
e.g: If there are 2 tabs (Projects, Events) in a tab object, then give object name as “projects” and “events”.
Step2: Create a script
Set Variable [$isProjectsInFrontTab ; GetLayoutObjectAttribute ( "projects"; "isFrontTabPanel" )]
Set Variable [$isEventsInFrontTab ; GetLayoutObjectAttribute ( "events"; "isFrontTabPanel" )]
//here "projects" and "events" is your layout tab-object names and "isFrontTabPanel" is pre-defined command
If [$isProjectsInFrontTab = 1]
//condition you want to run when "projects" tab is on.
Else If [$isEventsInFrontTab = 1]
// condition you want to run when "events" tab is on.
Now attach this script to your tab> script trigger> OnObjectModify (“specify your script”) in layoutmode.
Note: You can’t attach multiple scripts to a Tab. So you have to define different conditions in one script and run according to which tab is ON by theGetLayoutObjectAttribute ( “tabName”; “isFrontTabPanel” ). It doesn’t need any additional object to place just above the tab object and attach scripts to that.