Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Window Activation Trigger

All examples are included with download of MBS FileMaker Plugin.

Window Activation Trigger.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts3
Value Lists0
Custom Functions0
Custom Menus24
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Window Activation Trigger
1 field defined, 1 record
Window Activation Trigger

Fields

Table Name: Window Activation Trigger - 1 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
TestNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German

        Layout Objects: Window Activation Trigger

        Regular Fields

        Field Name: Window Activation Trigger::Test
        Field PropertiesCoordinatesField FormatField BehaviorQuick Find
        • Top: 52 pt
        • Left: 138 pt
        • Bottom: 155 pt
        • Right: 443 pt
        • Anchoring: Left, Top
        Field Format:
        • Edit Box
        Field Behavior:
        • Allow field to be entered: In Find mode, In Browse mode
        • Touch keyboard type: Default for Data Type
        • Go to next field using: Tab key
        Yes

        Buttons

        Button PropertiesCoordinatesScript/Script Step
          Type:
        • Text: New Window
        • Top: 204 pt
        • Left: 30 pt
        • Bottom: 243 pt
        • Right: 202 pt
        • Anchoring: Left, Top
        New Window [ Style: Document; Using layout: <Current Layout>; Close: Yes; Minimize: Yes; Maximize: Yes; Resize: Yes ]

        Button PropertiesCoordinatesScript/Script Step
          Type:
        • Text: Start Trigger
        • Top: 204 pt
        • Left: 220 pt
        • Bottom: 243 pt
        • Right: 392 pt
        • Anchoring: Left, Top
        Perform Script [ “Start Trigger” ]

        Scripts:


        Button PropertiesCoordinatesScript/Script Step
          Type:
        • Text: Stop Trigger
        • Top: 204 pt
        • Left: 410 pt
        • Bottom: 243 pt
        • Right: 582 pt
        • Anchoring: Left, Top
        Perform Script [ “Stop Trigger” ]

        Scripts:


        Script Hierarchy

        Stop Trigger
        Start Trigger
        Window Activated Trigger

        Next Script: [Start Trigger]
        Script NameStop Trigger
        Run script with full access privilegesOff
        Include In MenuYes
        Layouts that use this script
        Scripts that use this script
          Script Definition
          Script Steps
          • #stop trigger if it is running
          • If [ MBS( "FM.VariableExists"; "WindowActivateTrigger" ) ]
          • Set Variable [ $w; Value:MBS( "FM.VariableGet"; "WindowActivateTrigger" ) ]
          • Set Variable [ $r; Value:MBS("Schedule.Release"; $w) ]
          • Set Variable [ $r; Value:MBS( "FM.VariableClear"; "WindowActivateTrigger" ) ]
          • Set Variable [ $r; Value:MBS( "FM.VariableClear"; "WindowActivateTriggerCurrentWindow" ) ]
          • End If
          Fields used in this script
            Scripts used in this script
              Layouts used in this script
                Tables used in this script
                  Table occurrences used by this script
                    Custom Functions used by this script
                      Custom menu set used by this script

                        Previous Script: [Stop Trigger]Next Script: [Window Activated Trigger]
                        Script NameStart Trigger
                        Run script with full access privilegesOff
                        Include In MenuYes
                        Layouts that use this script
                        Scripts that use this script
                          Script Definition
                          Script Steps
                          • #current window
                          • Set Variable [ $currentWindow; Value:MBS("Window.Current") ]
                          • Set Variable [ $r; Value:MBS( "FM.VariableSet"; "WindowActivateTriggerCurrentWindow"; $currentWindow ) ]
                          • #Schedule a calculation to check window every second
                          • Set Variable [ $schedule; Value:MBS( "Schedule.EvaluateAfterDelay"; 1; "Let([ lastWindow = MBS( \"FM.VariableGet\"; \"WindowActivateTriggerCurrentWindow\" ); e1 = MBS(\"IsError\"); currentWindow = MBS( \"Window.Current\" ); e2 = MBS(\"IsError\"); r = If(e1 = 0 AND e2 = 0 AND lastWindow ≠ currentWindow; Let([ w = MBS( \"FM.VariableSet\"; \"WindowActivateTriggerCurrentWindow\"; currentWindow ); e = MBS( \"FM.RunScript\"; \"" & Get(FileName) & "\"; \"Window Activated Trigger\") ]; 0); 0) ];1)"; ""; ""; 1 ) ]
                          • Set Variable [ $r; Value:MBS( "FM.VariableSet"; "WindowActivateTrigger"; $schedule ) ]
                          Fields used in this script
                            Scripts used in this script
                              Layouts used in this script
                                Tables used in this script
                                  Table occurrences used by this script
                                    Custom Functions used by this script
                                      Custom menu set used by this script

                                        Previous Script: [Start Trigger]
                                        Script NameWindow Activated Trigger
                                        Run script with full access privilegesOff
                                        Include In MenuNo
                                        Layouts that use this script
                                          Scripts that use this script
                                            Script Definition
                                            Script Steps
                                            • #new window comes to front
                                            • Show Custom Dialog [ Title: "Triggered"; Message: "A new window is front!"; Default Button: “OK”, Commit: “Yes” ]
                                            Fields used in this script
                                              Scripts used in this script
                                                Layouts used in this script
                                                  Tables used in this script
                                                    Table occurrences used by this script
                                                      Custom Functions used by this script
                                                        Custom menu set used by this script

                                                          Download example: Window Activation Trigger

                                                          Used functions: