Example Programs

Create Configuration Files (.INI) for Your LabVIEW VIs

Introduction

You can create text files that contain information about the settings for the controls in your VIs.  There is a palette with VIs that write and read these configuration files and apply the settings to your controls and indicators.  These files are useful because they allow users to store default values for every control in the VI externally to the VI itself.  Many times VIs can be very complicated with numerous controls.  It is impractical to require the user to set each value every time before running.  Configuration files allow you to save settings and easily load them into your VI.  You can also store multiple configuration files.  This can be useful if you have several different operation modes, and need to have your control settings saved for each operation mode.

Steps to Complete

There are several different ways to approach this problem in LabVIEW.

LabVIEW built in VI's

This VI takes advantage of the VIs in the Configuration File VIs palette, which can be found by going to Functions»Programming»Configuration File VIs.  The files that these VIs allow you to create are simply text files that are organized in a particular manner.  These files are organized into sections and keys.  Each key corresponds to one particular control.  That is, it can hold information for one control on the front panel.  Sections are simply groups of keys.  These are just utilized to keep the keys ordered in an organized manner.

Examples of this can be found in the LabVIEW Example Finder > Fundamentals > File Input and Output. There are two examples: Read Configuration File Settings.vi and Write Configuration File Settings.vi.

OpenG.org Configuration Library

OpenG.org is a website focused on open source LabVIEW development.  There is a library with functions for writing variant data to configuration files called Oglib variantconfigThis library includes functions such as saving the entire front panel to a configuration file and the reloading the file.  Below is a snippet of a VI demonstrating this capability.

Front Panel Config File - OpenG.png

Additional Notes

The blocks in green are from the OpenG library. To install the OpenG libraries, you will first need to install JKI VI Package Manager.  As of the writing of this article, VI Package Manager was a Compatible with LabVIEW Gold Product. Explain


Wes P | Certified LabVIEW Architect

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

Comments
Member Shining_Eagle
Member
on

Config.jpg file not visible in Wbpage. Is is too difficult to create a link to download jpg and vi file directly?

Member MatGG
Member
on

It would be greater to talk of the openG ini library...Saving a cluster or a array (and most especially a type def) into a .ini file becomes much more easier with it!

Member TennesseePaul
Member
on

I have attempted using the OpenG VI's and come across a problem. When I attempt to compile the VI into an application I am hit with a Suspicious.Cloud.5 virus/trojan security risk. I have no issues without OpenG, so it would appear that the OpenG package discussed in this post is corrupt.

I downloaded necessary installations to complete this task 4 days ago. It is the most recent update to these files which are causing the problem.

Does anyone know if there is a solution?

Contributors