Get Access To A Running Executable From Another VI or Executable Through VI Server

Updated Mar 14, 2019

Reported In

Software

  • LabVIEW

Issue Details

Is there a way to get access to a running LabVIEW executable from another VI or executable. For example, getting values from indicators, setting values to controls, and initialize the Front Panel of the VI of the running LabVIEW executable.

Solution

In the VI of the running executable:
  1. LabVIEW VI server port need to be get and set using Server:Port property under VI Server >> Application class of the property node. Assign an unoccupied port number to it.
  2. Under the property node class, set Server:TCP Listener Active property to True.
  3. Under the property node class, specify Server:TCP/IP Access List to contain the IP address of the machine on which you access to the running executable. Check the format of the list through function context help in additional links.
  4. Use this VI as the main VI to build the executable.

In the VI initiating the control:
  1. Use Open Application Reference function with the IP address and the TCP/IP port number specified to get the reference to the instance of the running executable.
  2. Use Open VI Reference function to get the reference to the main vi of the executable. For example, Main.vi in the below code snippet.
  3. Use Control Value:Set and Control Value:Get invoke method to set and get the control values on the VI of the running executable.
  4. Other invoke method could be used. For example, Reinitialize All To Default Method.
  5. Remember to close the references to the executable and the VI.

Additional Information

  • Other than getting indicator values and setting control values, you could make use of VI server to achieve other control actions. For example, running VIs, getting image from Front Panel, etc.
  • You could control the VI running on local machine using localhost key word, and the VI running on a remote PC within the network by specifying the right IP address.