Example Code

Programmatically Open a VI from Another VI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview:

This allows you to choose a VI to open and run programmatically.

 

 

Description:

This example code makes use of the VI Server architecture by using the Open VI Reference, Invoke Nodes, and Close Reference. There are many different uses for Invoke Nodes and Property Nodes that you can basically change anything in a VI programmatically. In this case, there are two Invoke Nodes being used; one to open the Front Panel in its standard state and size and make it the active window and then another one to Run the VI that waits until the VI is done running to continue with the code and automatically disposing opened references within that VI. Make sure to use proper error handling throughout your code to ensure dataflow. 

 

For more information on Dynamic Process VIs, check out this video.

 

 

Requirements:

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code:

  1. Open the attached VI
  2. Provide a path to the VI you want to run
  3. Run The VI

 

Additional Information or References:

Block Diagram:

 BD.PNG

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

Great stuff!  Could you rename your attached .vi to include a more specific name and the LabVIEW version?

Todd S.
LabVIEW Community Manager
National Instruments
G-Money
NI Employee (retired)
on

Whatever you say....Todd!!! You want me to shine your shoes too? Great Job on the community bud!! Keep it up!!

Parny
Member
Member
on

Thanks for this lifesaver.

danny_t
Active Participant
Active Participant
on

To gain a better understand of what is going on here I would really recommend looking here

http://vishots.com/dynamic-process-vis-in-labview-part1/   and  http://vishots.com/dynamic-process-vis-in-labview-part-2/

Danny Thomson AshVire Ltd
ShogunOrta
Member
Member
on

This program IS Great!!! But is there a way to have the background VI held in pause until the recently opened VI is done running? Also a way to keep the opened VI visually "on top" of the background VI even in the case that a user presses on the background VI, in the case that it is visible while the top VI is running?

amal809
Member
Member
on

Thanks for the post. Kindly let me know if this functionality can be used once I convert this into an exe?