Showing results for 
Search instead for 
Did you mean: 

Scripting labview VIs using python or C++.

I have several labview VIs that I want to script using a text based language. In particular, I want to be able to run the VIs within python or C++, whereby I can provide the VI arguments in the code and read any data it returns. Does anyone have any experience with this, and if so could you point me in the right direction to get a starting point?



0 Kudos
Message 1 of 5

By scripting, do you mean writing up a VI from scratch by defining the block diagram and front panel programmatically from a "text-lanaguage"?

Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 5

I guess you want to call VIs (rather than script) from python or C++.


While in interpreted languages like python, the word "script" is used interchangeably with "code", in LabVIEW, "VI Scripting" has a completely different meaning. It is a LabVIEW code that can create or edit another LabVIEW code (block diagram / front panel).


You can of course call LabVIEW VIs from external code by first compiling them to a shared library (dll).

You can also compile them to a .NET assembly.


Then import the library in your code as you would do for a "standard" C dll or .NET dll.




Message 3 of 5

LabVIEW contains the so called VI Server. This is an Inter Application Control interface which also can be accessed from inside LabVIEW (which is by far the most easy way to use it).


There are two other interfaces, one is TCP/IP based and the other is ActiveX based.

The TCP/IP based interface is a proprietary binary communication protocol that is undocumented. The only documented way to access that is from within LabVIEW itself with its VI Server property and method nodes. One possibility is to create a LabVIEW DLL or .Net Assembly that does the necessary scripting calls and provides functions to do what you need. These functions can then be called from any other application and programming language that allows you to call DLL functions or .Net assemblies.


The ActiveX interface is a fairly small subset of the VI server protocol but would work for what you want to do. It is however legacy technology (Microsoft would love if they could make users forget that there ever was something like ActiveX). And NI has not invested anything in this interface since over 15 years. It still works but documentation about it is getting harder and harder to find as NI tries to remove most references to that, since there is factually nobody who will help you when it doesn't work. Python can call this interface with the pywin32 module and use the win32com class.


A few interesting links that may get you a bit further:



Rolf Kalbermatter
My Blog
Message 4 of 5

You don’t provide enough detail to show the complexity of the data being sent and received. If they can be expressed as simple strings, then the web server interface may be the quickest solution. Open the LabVIEW project and enable the web server. Any Language can send an HTML request with the VI path and any parameters and parse the response as the result. 

Look for sample code in the LabVIEW examples.

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 5 of 5