6 Replies Latest reply on Apr 23, 2014 8:31 AM by LarryGoldman

    File Options Script Triggers in FileMaker Pro 13

    LarryGoldman

      Title

      File Options Script Triggers in FileMaker Pro 13

      Post

           In FileMaker version 11, there was a File Option to run a script when the file opens.

           In FileMaker 13, this option has been replaced with an "OnFirstWindowOpen" script trigger.

           But there are two instances when a file is opened without a window: 1) when the file is opened as an external data source to another file; 2) when the file is "opened" on FileMaker server. In these cases the "OnFirstWindowOpen" script trigger does not fire.

           How does one trigger an initialization script when a file is opened without a window?

        • 1. Re: File Options Script Triggers in FileMaker Pro 13
          philmodjunk

               Why would you want to under those circumstances?

          • 2. Re: File Options Script Triggers in FileMaker Pro 13
            LarryGoldman

                 Say I had to perform one-time setup when the file is opened on the server before any clients log in, for example, registering ScriptMaster modules. Or say the data file needed to be prepared for WebDirect clients before any clients actually logged in. How does one execute a script when the file itself is opened, before any windows are opened?

                 Another scenario is when, in a data separation model solution, two different UI files reference the same Data file: I need the data file to initialize itself before either client UI file opens. I don't want to initialize the data file twice.

                 Also, in a related matter, if a file is opened (hidden) as an external data source, its specified "OnFirstWindowOpen" script is _not_ run, even if the file's window is eventually opened manually.

            • 3. Re: File Options Script Triggers in FileMaker Pro 13
              philmodjunk
                   

                        ...if the file is opened (hidden) as an external data source, its specified "OnFirstWindowOpen" specified script is _not_ run, even if the file's window is opened manually.

                   I can't reproduce that here in Windows 7. If I select the file from Show Window in the Window menu to open a window to the hidden file, the OnFirstWindow trigger is tripped and the assigned script is performed.

                   

                        Say I had to perform one-time setup when the file is opened on the server before any clients log in, for example, registering ScriptMaster modules. Or say the data file needed to be prepared for WebDirect clients before the any clients actually logged in. How does run execute a script with the file itself is opened, before any windows are opened?

                   While that would be a useful option, it isn't an option currently. But you can "prep" the File in FileMaker just before you upload it or use the server admin console to manually run a server scheduled script. I use that trick to make sure that key global fields are set to the correct value after uploading a file.

              • 4. Re: File Options Script Triggers in FileMaker Pro 13
                LarryGoldman

                     On closer examination, the "OnFirstWindowOpen" script trigger seems OK on Mac OS, too.

                     Running a startup script manually works around the problem, but I can see trying to remember to do that causing problems down the line.

                     IMHO, FileMaker Pro would be better if it had available two additional File Options script triggers: OnFileOpen (executed just after File Options layout -- if any -- is set but before any windows -- if any -- open) and OnFileClose (executed after the last window -- if any -- closes).

                • 5. Re: File Options Script Triggers in FileMaker Pro 13
                  philmodjunk

                       I'm not trying to convince you that such a feature would not be useful. I'm just listing what options are currently available. You are welcome to post a feature request for this if you want: http://www.filemaker.com/company/contact/feature_request.html

                  • 6. Re: File Options Script Triggers in FileMaker Pro 13
                    LarryGoldman

                         Feature request submitted!

                         Thanks for your help, PhilModJunk