Example Code

Creating an Enum Using VI Scripting

Code and Documents

Attachment

Overview
This example VI demonstrates the method to programmatically create an Enum using VI Scripting.

Description

The VI first creates a new VI at the path selected by the user in the File Dialog. It then opens a reference to the Block Diagram of this new VI and feeds this into a New VI Object function that creates an Enum Constant. This constant is then populated with the items from the String Array Control.

Once it has done this, and closed off the references, it saves the changes to the VI and then opens it for you to view.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Open the VI " VI Scripting - Creating an Enum Constant 2012 NIVerified.vi"
  2. Enter all the Items you want to be in your Enum into the String Array Control
  3. Run the VI.

 

Additional Information or References
VI Snippet

Block Diagram.png

 

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

James W
Controls Systems Engineer
STFC

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