Adding an Object to a VI Using VI Scripting

Requires: VI Scripting

You can use VI Scripting to programmatically add any object to the front panel or block diagram of a VI. These objects include:

What to Use

This VI Scripting task requires the following objects:

New VI Object Class Specifier Constant Close Reference
 Add  Find
 Add  Find
 Add  Find

What to Do

Before you start: Open the Adding Objects VI in the labview\examples\Application Control\VI Scripting\Creating Objects directory for an example that illustrates each step of the following procedure.

 Open Example

Expand the procedure for more information about this specific example.

  1. Obtain a reference to the target VI.
  2. Determine the defining information of the new object that you want to create.
  3. Use a New VI Object function to add the new object to the target VI by wiring the information from step 2 to the function.
  4. (Optional) Programmatically wire the newly created object to existing objects in the target VI.

    Refer to the Additional Examples section for an example of using VI scripting to wire objects.

  5. Use the Close Reference function to close each open object reference when you are finished using it.

Caveats and Recommendations

Additional Examples

Refer to the Creating New VI From Scratch VI in the labview\examples\Application Control\VI Scripting\Creating VIs directory for an example of adding an array control, a numeric indicator, and a call to a subVI to a target VI.

 Open example  Find related examples

Refer to the Drop Add Function Inside While Loop VI in the labview\examples\Application Control\VI Scripting\Creating Objects directory for an example of adding an Add function inside of another object such as a While Loop.

 Open example  Find related examples

Refer to the Drop Digital Numeric Inside Cluster VI in the labview\examples\Application Control\VI Scripting\Creating Objects directory for an example of adding an object to a cluster.

 Open example  Find related examples