Showing results for 
Search instead for 
Did you mean: 

User configuration file that can be altered without programmatic changes to VI

I am using Labview 8.2 on Windows XP, and am relatively new to Labview.  I am developing a labview program that controls a scanner (via AO) and acquires data (count frequency). I would like to develop a simple configuration file that stores common scan ranges with associated names in an ASCII file so that the scan be selected from an interface such as a menu ring. I need this file to be flexible, so that the end user (whom will not be labview-literate) can edit the configuration file in a text editor. These edits include changing the numerical range of a particular scan (AO) as well as deleting or adding new scans. I wish to have start and end numeric values stored along with an associated name (menu choice). The VI I have calls the scan start and end values as local variables, so the only information I need. There are two "types" of scans that I want, each with different start and end values.
So as an example, a starting config file looking something like this:
would give menu options for scan type 1 or 2,and then a selection of scan A or scan B. The code would communicate the numeric values to the rest of the VI by either wires or as a local variable.
The user could then manually add in lines in the configuration file to create a new scan (scan_C_high and scan_C_low), and the VI when next loaded would include this new scan option.
Any suggestions are greatly appreciated!
Wes Gordon
0 Kudos
Message 1 of 5
Not sure what you're asking for. Your idea is reasonable and fairly common. Are you asking how to read/write these files? The format seems to be a standard config (.ini) format, so the configuration file functions in LabVIEW can be used for that. Are you asking what kind of user interface to provide or how to create it? Or are you asking how to provide an editor for these files in LabVIEW?
0 Kudos
Message 2 of 5


Thanks for replying.  I am sorry I was not clear enough.

Mainly I am interested in the method(s) people have used to control menu selections (along with associated numeric values) using configuration files that can be added to or altered without having to adjust the programming in the VI. I understand INI files and how to use the configuration tool library to write/read values, but I am not sure of a good way to program the VI to list the key properties (the name that the user selects) in a menu and then output the associated numeric value for that property. I can assume that future users will be able to manually alter the config file in a text editor, so my question is focused on developing the VI code.

In other words, using the above example INI, I would want the user to be able to change the values of the keys or add new keys such as:

and then run the VI, which has menus where the user selects (Scantype.1 or Scantype.2) and then (scan_A, scan_B, or scan_C).
If the user selected Scantype.2 and scan_C, then the VI would output two values: 0 and 1686.5.
Hopefully that clarifies my question.
0 Kudos
Message 3 of 5
Modifying menu items is done by using property nodes. For example, if you have a menu ring you use the "Strings[]" property node and wire in an array of string. These would be the menu items that the user sees. So, when your application starts you just read your config file and parse it out to generate the arrays of strings that would be the menu items and wire them to the individual property nodes for each menu ring on your front panel. The value of the menu ring corresponds to the index selected so you'll know which one the user selected. That's pretty much all there is to it, and a fairly common way of doing it. In my applications I do this quite often. For example, in the test executive for the testing we have here there's a menu ring that lists all of the test lists available for testing. This list is populated by getting a directory listing of test lists contained in a directory. This array of strings is fed to the "strings[]" property node and voila', the user can select with test list to run from there.

As far as the configuration files, it's usually not a good idea to have end-users editing your configuration files directly since your application depends on a specific format, and you can't guarantee that users will know, or remember, what that format is. It's better to provide a simple configuration file editor that your users can use without having to modify the file directly.

Message 4 of 5

Thanks alot! I think I have it all worked out now.

Smiley Happy

0 Kudos
Message 5 of 5