Action: ExecuteExternalCommand
Function: The action starts a process (application, batch script, etc.) outside of CODESYS and captures its output and exit code.
Call: System test driver
In general, the behavior of the action depends on the Only start and Check of the previous process from the input parameter options. The following cases are possible:
The Only start and Check of the previous process from the input parameter options are disabled. This is used for starting a process synchronously and waiting for it to end. The test script is paused during this time.
Only the Only start option is enabled. This is used for starting a process asynchronously and later querying its result in the test script. The context of the process is stored in a variable.
Only the Check of the previous process from the input parameter option is enabled. This is used for querying the result of a process started asynchronously from its saved context.
Tab: Configuration
Executable file | Name of the process which is started Example: Requirement: The Check of the previous process from the input parameter option is disabled. |
Arguments | Command-line arguments Optional Example: Requirement: The Check of the previous process from the input parameter option is disabled. |
Working directory | Working directory of the process Optional Requirement: The Check of the previous process from the input parameter option is disabled. |
Only start |
Requirement: The Check of the previous process from the input parameter option is disabled. |
Save process in output parameter (leave blank to ignore) | Output Parameters Specified without quotation marks Example: The execution context of the process is stored in this output parameter. If the Check of the previous process from the input parameter option is enabled when the command is executed later, then this output parameter can be evaluated. Optional Requirement: The Only start option is enabled. |
Check of the previous process from the input parameter |
|
Wait for exit [ms] | Number of milliseconds to wait for the process to end If the external process takes longer than this time limit, then the action fails. If no value is entered here, then there is no time limit and the action may wait indefinitely. Requirement: The Only start option is disabled. |
Delay [ms] | Time span for the action to wait before it returns If no value is entered here, then the action returns immediately after starting the process without waiting for the process to end. Requirement: The Only start option is enabled. |
Exit code | Checks the exit code of the process If the code does not match, then the action fails. If the field is left blank, then there is no check of the exit code. Requirement: The Only start option is disabled. |
Save stdout to | Name of the output parameter Specified without quotation marks Example: When a valid parameter name is specified, the action saves the default output stream of the external process to the specified output parameter. Requirement: The Only start option is disabled. |
Check result from stdout |
Requirement: The Only start option is disabled. |
Contain mode |
Requirement: The Check result from stdout option is enabled. |
Result conforms | Input field When the Check result from stdout or Contain mode options are enabled, the contents are compared with the output stream of the process. Requirement: The Check result from stdout option is enabled. |
Tab: Parameters
The parameters defined on the Parameters tab are used to exchange values between test script variables and parameters of test actions. Parameters can be used as placeholders on the Configuration tab. For this, the name of the parameter is set in braces in the configuration dialog. Example: {name}
.
Tip
Variables defined globally in the script (with the prefix $GLOBALS.
) can be used directly in the test action. It is not necessary to use input parameters for passing. Using output parameters is necessary for writing global variables.
Input parameters: When executing the test action, the values of the test script variables are passed to the input parameters of the test action and can be used in the configuration of the test action. | |
Output parameters: When executing the test action, the values of the output parameters of the test action are passed to the test script variables and can be used (for example, in other test actions). | |
Name | Name of the input/output parameter This name is defined in addition to the variable name to identify the origin of the parameter when it is passed to another script. During the test run, this name is displayed as the Outer name on the Variables (scope #<n>) tab in the Test progress window. Background: When a script To see that this variable is recognized as variable |
Variable | Name of the test script variable Example: |
Move Up | Moves the selected variable one line up |
Move Down | Moves the selected variable one line down |
Remove | Removes the selected variable from the list |