Passing Data Between LabVIEW Executable Reference VI and a VI

Updated Aug 24, 2023

Environment

Software

  • LabVIEW Full
  • LabVIEW Professional
  • LabVIEW Application Builder Module
  • LabVIEW Base

Programming Language

  • LabVIEW G

I built a LabVIEW executable using LabVIEW Application Builder and want to automate accessing controls or indicators in my executable from another VI. How do I set this up?

To access the controls and indicators of a built executable, you first need to enable VI Server support for an executable follow the steps below:
  1. Use LabVIEW Application Builder to create your executable.
  2. Navigate to the directory containing your application and open <application name>.ini.
  3. Add the following lines to the end of your application's INI file:
server.tcp.enabled=True
server.tcp.port=3364
  1. To connect to the VI Server running for the executable, open a new VI and place the Open Application Reference function.
  2. Wire a constant or control to the machine name input and set it to localhost. If you don't do this, your VI will try to connect to the default LabVIEW VI Server instead of the executable.
  3. Wire a constant or control to the port input and set it to the tcp port number you specified in Step 3.
You now have a reference to your application and can use property and invoke nodes to read/modify the application's behavior. You then need to open a VI reference:
  1. Drop an Open VI Reference function on the block diagram.
  2. Wire the application reference output of the Open Application Reference function to the application reference input of the Open VI Reference Function.
  3. Wire a string constant or control into the vi path input of the Open VI Reference function. In the string constant or control, specify the name of the VI that you previously built into the executable.
You now have a VI reference, which can be used to access objects on the front panel of VI reference of your executable. The following image shows an example of opening a VI Reference for an executable:

Additional Information

  • Creating VI server settings from the Tools-Options->Vi Server menu only applies to VI's that are not being run from within a project. If you want to set these settings for a VI within a LabVIEW project, you will need to generate set these settings through VI Server property nodes.
  • This method will work just to make changes in the VI refence of the executable but not the executable itself. If you would like to modify the controls of the executable you will need to take another approach and use shared variables instead.