« Interactive FileMaker… | Home | MBS FileMaker Plugin,… »

Running command lines tools on Windows

The last days, I spend some time on a class for Windows to run a process with access to the stdin/stdout/stderr channels. I know the Xojo Shell class can do that, but I wanted a bit more Windows specific commands here.
So we got a new WindowsProcessMBS class to run a process on Windows. You can run GUI or command line applications and specify a couple of options. The plugin will automatically connect stdin, stdout and stderror handles, so the plugin can read the output of the tool and pass data for input. The class can be used synchronously or with events, whatever you prefer. Here an example:
// run command dim w as new WindowsProcessMBS w.CommandLine = "cmd /c dir" w.CurrentDirectory = "C:" if not w.run then MsgBox w.LastErrorMessage Return end if // wait while w.Running app.YieldToNextThread wend // show result dim a as integer = w.AvailableBytesOutput dim r as string = w.ReadOutput(a) MsgBox r
We already got features to specify command line and environment variables. You can read or just peek in the output of the launched application. We can even terminate it or just wait for it to quit. This class will be available in 17.1pr1 plugins soon. If you want to test on the weekend, send me an email.
03 02 17 - 17:30