10 Replies Latest reply on Jul 14, 2014 5:10 PM by brianouimette

    FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers

    brianouimette

      I am wondering if there is any way to pass parameters from an FMP URL that will be accessible to the ONFIRSTWINDOWOPEN script. I am trying to call a script in the database and pass a parameter through that will be seen by the ONFIRSTWINDOWOPEN script. A few attempts have been unsuccessful. The parameters get passed to the script I am calling however it is not seen by the open script. An If statement will check for a specific parameter and if the parameter is present it will exit the open script and continue with the script called in the FMP URL. Any help would be helpful.

        • 1. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
          Malcolm

          parameters get passed to the script I am calling …

           

          Doesn’t that tell you something?

           

          You have two options. Send the parameters to the OnFirstWindowOpen script. You’ll need to modify that script so that it will run your other script. The second option is to modify the script you are calling. Get it to call the OnFirstWindowOpen script. You can pass the current set of script parameters when you call it.

           

          malcolm

          • 2. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
            brianouimette

            I have tried to call the Open script in the URL with the parameters however that does not work. I am assuming that because the script trigger onfirstwindowopen takes priority it must process first and I assume the parameters likely need to be pre-specified in the file options dialog. The second option might be the best. I was hoping there would be another option as the open script we have contains 6-7 scripts tied to it and contains a custom login screen so having a way for the parameter to pass through would be nice.

            • 3. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
              Malcolm

              OnFirstWindowOpen is called automatically. This means that it will be run without parameters because there is no option to include parameters for the Window Open/Close scripts.

               

              Because its always called the OnFirstWindowOpen script should include testing for a variety of conditions, such as the application version. Your onFirstWindowOpen script may be useful for fmPro clients but not for web clients or server scripts.

               

              Early on in the called script, call the OnFirstWindowOpen script and pass the parameters. If you tested for the right conditions in the OnFirstWindowOpen script you could have stopped it from running. This time ( you’ll have added code which tests for parameters ) it will run and then the rest of the called script will run.

               

               

              Malcolm

              • 4. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                BruceHerbach

                As Malcome stated,  the OnFirstWindowOpen script doesn't take parameters.  You can use Get(applicationVersion) and other get functions to determine what platform, or what user or group opened the file.  With these the script can determine what has to be done when the file is  opened.

                • 5. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                  DavidJondreau

                  A kludgy answer would be to have whatver needs to be run on FirstWindowOpen go into a new script and have the FirstWindowOpen script call that new script using OnTimer[]. Then your URL-called script can set global variables that feed the OnTimer script.

                  • 6. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                    Stephen Huston

                    What specific information are you trying to have the script use?

                    • 7. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                      brianouimette

                      If possible I just want a variable or parameter to be passed to cause an exit script. The open script is a custom dialog login but the script I am calling in the fmp URL will have their account name and encoded password along with a few other parameters in XML format. The script I am calling will parse the XML parameters and if the "exit" parameter it would exit the open script and continue the called script and attempt a re-login and then continue the script and process the rest of the parameters.

                      • 8. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                        BruceHerbach

                        You can't pass a parameter to the OnOpen script.  A work around would be to check the information available using a get function in an if statement.  Based on the return from the Get function call or exit a script.

                        • 9. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                          Malcolm

                          If you inspect your script you'll see that a custom dialog isn't supported in Server or CWP. I haven't checked but I presume that scripts passed by URL would be CWP.  If I'm right, then your onOpen script will fail at the custom dialog. What happens next depends on your scripting.

                           

                          If you begin your onOpen script by testing environment you can exit the script when it is a CWP session and there are no parameters. However, if there are parameters, then you can run the script using them to login.

                          • 10. Re: FMP URL Parameters and ONFIRSTWINDOWOPEN Script Triggers
                            brianouimette

                            This is not for CWP. I have a second product that I want to launch our fm go product and if the request is coming from that product I want to exit the normal open script (by passing a specific parameter) and continue with the script I am calling in the url with the parameters I specify. The other product is being developed by a different in house developer and is easiest opened with the fmp url coming from that product and is the method they have chosen to use for a rough integration at this point. I was hoping there would be a way to accomplish but that looks like it wont happen, which is fine, it just means my users will have to enter login credentials (which are stored in the other product and can be encoded to be passed as a parameter without giving away the users login info and decoded inside filemaker) and one other step prior to performing the called script from the url. I was hoping to avoid this by passing a parameter somehow to the open script and if present it would take the other parameters for login and what action and perform the appropriate scripts.