8 Replies Latest reply on Nov 19, 2016 11:33 AM by tsommer

    Start External Process

    tsommer

      Dear Community,

       

      I am new to FM and I am evaluating it currently. Is it possible to start an external process in order to process a given value? Lets say: The user gives some text data and I want to forward it into some text mining algorithms (external process). The result of this process should be stored into FM, together with the text.

       

      I know, that I could request a URL. Thus, the web server could do this and yield the result. But can I start an external process on the same machine e.g. a bash script?

       

       

      Best regards

      Thorsten

        • 1. Re: Start External Process
          taylorsharpe

          FileMaker server Schedule script can schedule batch OS level jobs, but FileMaker Pro cannot without a plugin.  But if you use the free Base Elements plugin, you can issue terminal commands which could start such a process.  Or if the process has an API, you can always have FileMaker talk to it via HTTP POST, etc. 

          • 2. Re: Start External Process
            David Moyer

            Hi,

            I think the difficult part is starting a process from FM and having FM wait for the result before continuing.  I've done this in a super-cumbersome, but fully effective way, using executable files.  But these days, I'd prefer the web service (and the Insert from URL script step).  That's because FM waits for the service's response before continuing, without software acrobatics.  Sorry that's not the option you want.

            • 3. Re: Start External Process
              wimdecorte

              tsommer wrote:

               

              Dear Community,

               

              I am new to FM and I am evaluating it currently. Is it possible to start an external process in order to process a given value?

               

              Are you think the FileMaker Server or a FM client?

               

              A client can leverage things like the Send Event script step, Perform AppleScript to start something externally and through the FM ActiveX interface and Apple Events interface those external things can then talk back to FM.

              • 4. Re: Start External Process
                astelix

                With the MBS Filemaker Plugin it is possible to run external processes, wait for the result and process it. i did this wih R Statistics software.

                • 5. Re: Start External Process
                  tsommer

                  Thanks to all, for the great answers. @ taylorsharpe: the BE_ExecuteSystemCommand was what I looked for. @astelix: Could you post an example script or line how to use MBS and execute a R command or script? MBS contains more than 4,000 commands -- Right away, I could not found the right one...

                   

                   

                   

                  • 6. Re: Start External Process
                    fmpdude

                    Agreed!

                     

                    FileMaker is super easy to integrate with REST or SOAP web services and I have several running now. As long as you have FMP 13 or greater you can do both POST and GET Requests. (They added POST in 13.)

                     

                    FileMaker's script step: "INSERT FROM URL" is your friend here.

                     

                    HOPE THIS HELPS.

                    1 of 1 people found this helpful
                    • 7. Re: Start External Process
                      astelix

                      I define a Custom Function named "RunScript" this way:

                       

                      RunScript(script_name):

                      SetVariable ( [

                      r = MBS( "RunTask.NewTask" );

                      # Path to the script command

                      r = MBS( "RunTask.SetLaunchPath"; "/usr/local/bin/rscript" );

                      r = MBS( "RunTask.SetArguments"; script_name );

                      r = MBS( "RunTask.Launch");

                      r = MBS( "RunTask.Wait"; "30");

                      output = MBS( "RunTask.ReadOutputText"; "utf8")

                      ]

                      ; output )

                       

                      And I use it in my script:

                       

                      Set Variable [ $job ; Value: SetVariable:  "/Users/MyHome/MyWorkDir/MyRJob.R" ]

                      Set Variable[ $resultat ; Value: RunRScript ($job) ]

                      Show Custom Dialog [ "Resultat" ; $resultat ]

                      1 of 1 people found this helpful
                      • 8. Re: Start External Process
                        tsommer

                        Thanks astelix for the example. This is very helpful.