Obtaining a VI Reference

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Requires: VI Scripting

To use VI Scripting to inspect, modify, or create VIs and VI objects, you must usually begin by obtaining a reference to the target VI with which you want to interact. You then can use the reference to obtain references to objects within the target VI or to add new objects to the target VI.

Refer to the following table to identify the best way to obtain a VI reference for your specific use case.

Type of Target VIHow to Obtain a Reference to the Target VI
Pre-existing target VI whose path you know at edit timeStatic VI Reference

Pre-existing target VI that you want to select at run time

Target VI that you intend to call with the Call By Reference node
Open VI Reference

New VINew VI

New VI with contents copied from a template VICreate a new VI from a template.

Caveats and Recommendations

  • Create complicated new VIs from a template when possible—While you can create a new VI programmatically by creating each individual component object one at a time, it is much easier to create a new VI from a template and then modify small sections of the code.
  • Displaying the target VI is optional—You do not have to display the front panel or block diagram of a target VI in order to inspect or edit the VI programmatically. However, you can use the following properties and methods to display different parts of the target VI:
  • Close all references that you open—An excessive number of open references negatively impacts the performance of a VI. Read about closing VI and object references for more performance details.


Not Helpful