Example Code

Programmatically Set User Inputs as Default Values

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 VI is designed to demonstrate using .ini configuration files to store user input; such that, user definitions may be loaded as default values on start up.


Description: This VI is designed to demonstrate using .ini configuration files to store user input; such that, user definitions may be loaded as default values on start up. Configuration files can be used to store information on a limited number of data types; however, can be effectively utilized to store vital configuration data to be used on execution. This example may also be incorporated in executable deployment to allow customized settings to be uniquely tailored to a wide variety of distribution machines.


Requirements: LabVIEW 2012 (or compatible). Hardware: none.


Steps to Implement or Execute Code:

1. Define relative file path for creation (or reference to) the .ini file.
2. Open//Create an .ini configuration file.
3. Read a Key from the configuration file, given [Section] and [Key Name] input.
4. Use local variables to set Key data as initial control value.
5. Implement Wait method to accept new User settings.
6. Perform application execution.
7. Write any User changes to .ini Key, give [Section] and [Key Name] input.
8. Close Reference to the .ini file.


Additional Information or References:

 

Programmatically Set User Inputs as Default Values FP.png

 

Programmatically Set User Inputs as Default Values BD.png


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

 

 

 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

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