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:
- Use LabVIEW Application Builder to create your executable.
- Navigate to the directory containing your application and open <application name>.ini.
- Add the following lines to the end of your application's INI file:
server.tcp.enabled=True
server.tcp.port=3364
- To connect to the VI Server running for the executable, open a new VI and place the Open Application Reference function.
- 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.
- 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:
- Drop an Open VI Reference function on the block diagram.
- Wire the application reference output of the Open Application Reference function to the application reference input of the Open VI Reference Function.
- 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.