6 Replies Latest reply on Jul 26, 2017 3:34 PM by user15003

    Perform Script (Script Name by calculation)

    MJH

      Title

      Perform Script (Script Name by calculation)

      Post

      I would like to be able to execute a script by supplying the script name as a variable to the Perform Script command, i.e.

       

      Set variable[$scriptName; Value:"ListRecords"]

      Perform Script($scriptName)

       

      Filemaker can do something similar with the Go To Layout(Layout Name by Calculation) command, but I don't see anyway to do this with Perform Script.

       

      Thanks for any insight.

       

       

        • 1. Re: Perform Script (Script Name by calculation)
          Orlando
            

          Hi MJH

           

          Are you calling the script as a subscript or from a button on a layout? 

           

          Either way this is not possible with FileMaker natively as you describe.

           

          However if you are calling the script from a button on a layout there is one plug-in I have recently started implementing called Fusion Reactor that will allow this.

           

          http://fusionplugins.com/reactor/ 

           

          It uses the web viewer and a calculation to specify the parameters of the button, including the script called and script parameters, this calc can be changed based on the state of the record, you can also disable buttons. There are also a whole lot of other great features so worth a look even if its not what you are looking for here.

           

          If you are calling the script as a subscript I think you would need to put in place a number of If and Else If statements to go to the required script.

           

          I hope this makes sense. 

           

          • 2. Re: Perform Script (Script Name by calculation)
            Sorbsbuster
              

            First, my excuse: it's late at night here in Ireland.

             

            Now: does EventScript (free plugin from SoftwareForHumans) not cover this perfectly?  And probably zippscript (I downloaded it ages ago, distributed it to lots of friends, but because I'd finally worked out how EventScript worked I never got round to using it myself...) ?

             

            EventScript, for instance, works by running a particular script based on the outcome of a calculation.  The calculation can be a pull-down menu, a script parameter tied to a button... anything.  So, wherever the 'Set Variable' would come from, just use that.

             

            Alan.

            • 3. Re: Perform Script (Script Name by calculation)
              destroid

              You can effectively do this with the FMP URL function. See link for more info.

              Example:

               

              FMP://[[account:password@]netaddress]/databasename [?script=scriptname[&param=scriptparameter][&$variablename=value] ]

              FMP URL Scheme and the 13.0v2 Improvement | iSolutions 

              • 4. Re: Perform Script (Script Name by calculation)
                siplus

                To strictly answer your question, there is no way of passing the name of a script, its database and its parameters to the perform script script step.

                 

                There are tricks and plugins dealing with this, depending on your needs. What would possibly apply to your needs is just a step away, but you must provide the step, i.e. what are you actually trying to achieve.

                • 5. Re: Perform Script (Script Name by calculation)
                  Jaymo

                  LOL... the original question was posted in 2008. Never too late I say!

                  • 6. Re: Perform Script (Script Name by calculation)
                    user15003

                    Never tried before but I hope this help:

                     

                    BaseElements plugin from Perform Script on Server

                    BE_ExecuteScript

                    BE_ExecuteScript – BaseElements Plugin Help Centre

                     

                    Performs the scriptName in the current file ( if no fileName provided, or in fileName if available ). Scripts are run when the current script queue is empty, so you can't have a calculation within a script, call a script and have it start immediately, it will run at the completion of the current script. Script results are not set and cannot be returned.

                     

                    Version : 1.2

                     

                    Parameters :
                    scriptName : the name of the script to perform.
                    fileName ( optional ) : a filename to locate the script. Defaults to the current file if not supplied. Be aware, there is an issue in the plugin API where filenames can only have a single "." in their name. Files with more than one will return an error 100 - File is missing.
                    parameter ( optional ) : the parameter to pass to the script called.