Runs an executable and redirects the output to OpenInsight.
|Command||The DOS prompt command to execute. Required.|
|Output||Indicates how the command output is redirected. Optional. Output is not redirected if omitted.|
|WorkingDir||Sets the working directory. Optional. Defaults to current working directory if omitted.|
|TimeDelay||Time, in milliseconds, to allow the process to run before checking for more output. Optional. Defaults to 250 if omitted.|
The SRP_Run_Command is convenient way to execute DOS command lines from OpenInsight, especially when you need to redirect the output to something other than a DOS window. Note that SRP_Run_Command executes these commands synchronously, that is, it will not return until the command completes execution.
The Command parameter is the only required variable. Simply set this to the command you wish to execute. This can be any valid command acceptable to the DOS window.
The Output parameter controls where output is redirected. The output can be redirected to three locations: variables, DOS window, or an OpenInsight EDITLINE or EDITBOX.
To redirect output to a variable, set a variable to the value of "VAR" and pass it via the Output parameter. When SRP_Run_Command returns, the variable you passed will contain the output data. To redirect to a DOS window, set the Output parameter to "DOS" or "DOSOPEN". Use "DOSOPEN" to keep the DOS window open after the process completes. Use "DOS" to close the DOS window automatically. Finally, if you want to redirect the output to an OI EDITLINE or EDITBOX, simply set the Output parameter to the fully qualified control entity id. If you omit the Output parameter, the output will not be redirected.
Some commands ask for user input, so use caution when redirecting output to a variable or OI control since neither of these options can accept user input. In the event that input is requested and the output is set to "VAR" or an OI control, the application will appear to hang while waiting for the process to end. To bring control back to the application, you'll need to kill the process that is waiting for input via the Task Manager.
The WorkingDir parameter sets the working directory for the process. Note that this will not affect the current working directory for OpenInsight. This is useful if you are running a command that relies on the current working directory, such as the "dir" DOS command. If you want to use OpenInsight's current working directory, simply omit this variable or leave it blank.
The TimeDelay parameter determines the frequency in which SRP_Run_Command polls for output. Most DOS commands take time to deliver output, so there is no need to redirect it every CPU cycle. Instead, it's best to check for new output every so often. You can have it wait as long as several seconds or have it check every millisecond. If you leave this parameter blank or omit it, then SRP_Run_Command will check for output every 250 milliseconds.