Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Scripting Languages and Executables from LabVIEW

 

» Calling External Code » Calling Scriping Languages and Executables

Running Built Executables from LabVIEW

LabVIEW allows developers to run executables from VIs using the System Exec VI (Functions Palette » Connectivity » Libraries & Executables » System Exec).

 

This VI allows the developer to pass command line arguments to the executable. In addition, the System Exec VI redirects the Standard Input, Standard Output and Standard Error pipes of the executable to LabVIEW so that you can access these from your VI.

References & Examples

The following example installs with LabVIEW:
Calling System Exec VI: labview\examples\comm\Calling System Exec.vi

 

Community Example: Ping a Computer Name, IP, or URL Using System Exec

 

Calling Scripting Languages from LabVIEW

Scripting Languages are programming languages that are typically interpreted during run-time rather than compiled into an executable before running. This means that in order to run a script written in a scripting language, the computer needs to invoke the language’s interpreter.

 

Examples of scripting languages include Perl, Python and Tcl.
Introduction to Scripting in Perl, Python and Tcl

 

There are two ways run a script and invoke the interpreter for a scripting language:

  1. Call the interpreter and pass the script file’s path as a command line argument

  2. Register the script file’s extension to automatically invoke the interpreter. This is automatically done by some interpreter installers.

 

Both these options are detailed in the tutorial linked above.

 

Use the System Exec VI (Functions Palette » Connectivity » Libraries & Executables » System Exec) to run a script from LabVIEW. To run the script, call the interpreter using the System Exec VI, and pass in the script file path as a command line argument. Alternatively, if you have registered the script file’s extension with the interpreter, you can run the script directly by passing in the script file’s path to the Command Line input of the System Exec VI.

References & Examples

 

Community Example: Calling Python Code from LabVIEW

 

Jervin Justin
NI TestStand Product Manager