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 VI How to Obtain a Reference to the Target VI
Pre-existing target VI whose path you know at edit time Static 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 VI New VI
New VI with contents copied from a template VI Create 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.