SYSTEM
Function Name |
SYSTEM |
---|---|
Description |
Allows an .exe file to be executed from a Logic program. The SYSTEM function places each execute command in a list, with the latest command being added to the bottom of the list. The commands are executed in turn and can only be executed when the previous command has been executed (if the command runs an application, the application has to be closed before the next system command is executed). For this reason, there can be delays between the time a Logic program is run and the time the executable file is executed (the command from the SYSTEM function is placed in a queue). |
Arguments |
IN {STRING} The IN input is a string that specifies the path to an executable file. For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Executes the executable file at the location specified in the IN input. If the .exe file cannot be found at the defined location, the SYSTEM function will have no effect. |
ATTENTION: Do not use SYSTEM to call interactive processes, for example, running interactive programs like Microsoft Notepad. Interactive processes only complete after the user closes the application and so will prevent any other system commands from executing.
Example:
Function Block Diagram - SYSTEM:
In this example, the IN input is 'C:\Windows\Nd.exe', so when the program executes, the Nd application will run.
ST Program - SYSTEM:
To use a SYSTEM function in an ST program, you need to use this syntax:
- VAR
- A : DINT;
- END_VAR
- A := SYSTEM( 'C:\Windows\SetInstall.exe' );
The output of the SYSTEM function has to be stored as a variable (DINT). In this case, a variable named A is used and the string for the SYSTEM's IN input is 'C:\Windows\SetInstall.exe'.