Programmatically Read VI Metadata Without Loading Dependencies

Updated Nov 26, 2024

Environment

Software

  • LabVIEW

When programmatically reading VI metadata (such as VI name, description or path), LabVIEW will load the VI's dependencies into memory. If the VI is broken, or dependencies are missing, this causes a dialog pop-up prompting the user to identify the missing dependencies.

 

For applications that require only reading metadata regardless if the VI or it's dependencies are broken (and without user interaction), a Private Property called App.SearchPaths can be used.

 

This article demonstrates the use of App.SearchPaths to obtain a VI's description. Refer to the section titled Usage Within Executables if you plan to use this method within a built LabVIEW executable.

 

WARNING:

This approach should only be used to read metadata. If you need to write metadata or make any changes to a VI, do not use this method. Writing to a VI with this method causes changes to be saved on a broken VI. To write changes, it is necessary to load the dependencies beforehand.

Suppressing Dependencies

To read a VI's metadata while suppressing the loading of it's dependencies, follow the steps below:

 

  1. Private Methods and Properties must be enabled in LabVIEW.
    1. Ensure that LabVIEW is closed.
    2. Navigate to C:\Program Files (x86)\National Instruments\LabVIEW <version> and open the LabVIEW.ini file in a text editor.
    3. At the bottom of the file, add SuperSecretPrivateSpecialStuff=True
    4. Save the file and restart LabVIEW.

 

Adding INI token.PNG

 

  1. Create a new VI, which will be responsible for reading the metadata of other VIs.
  2. On the Block Diagram, place a Property Node from the Application Control palette.
  3. Click on the Property Node and change the active Property to Application >> Search Paths.

 

SearchPaths property.PNG

 

  1. Right-click the Property and select Change All to Write.

 

Change All to Write.PNG

 

  1. Right-click the Property and select Create >> Constant. Ensure that the Constant remains an empty array.
    • This allows LabVIEW to ignore dependencies when opening a VI reference.

 

Create Constant.PNG

 

  1. Place an Open VI Reference function from the Application Control palette.
  2. On the VI Path input, wire a Constant or Control that contains the path to the VI that you wish to read metadata from.

 

Open VI Reference.png

 

  1. Place another Property Node.
  2. Connect the VI Reference output from Open VI Reference to the Reference input of the Property Node.

 

Property Node.PNG

 

  1. On the new Property Node, select the VI metadata that you wish to read. This example uses the VI Description property.

 

VI Description.PNG

 

  1. Place a Close Reference function from the Application Control palette.
  2. Connect the Reference Out output of the Property Node to the Reference input of Close Reference.

 

Read VI Description.png

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

 

Usage Within Executables

If you wish to build this VI into an executable, the VI that you wish to read metadata from must have the Separate compiled code from source file setting disabled.

Follow the steps below to implement this:

 

  1. In LabVIEW, open the VI that you wish to read metadata from.
  2. From the top toolbar, select File >> VI Properties.

 

Vi Properties.PNG

 

  1. In the pop-up window, ensure General is the selected Category.
  2. Uncheck the Separate compiled code from source file option.
  3. Click OK to apply changes.

 

Uncheck option.PNG

 

  1. Save and close the VI.

After following the steps in this article, the VI will programmatically open a reference to another VI and read it's description. There is no user input required or delay when reading the description of a broken VI or VIs whose dependencies are missing.

 

The complete VI (compatible with LabVIEW 2019 and newer) is attached to this article for download.