12-11-2015 09:58 AM
I'm doing some planning for a new project and need to figure out the best way to allow the user to save there preferences and settings. The main VI be used for troubleshooting equipment and the operator will be able to choose which sequence of test they want to run. I would like to be able to save the user specific prefference for each piece of equipment they are testing to some kind of prefference file. I have written data to text and spreadsheets before but didn't know if there was a better way to save user preferences than simply writing plan text to a text file. Any suggestions as to a perfered method for saving user preferences and settins?
Thank you
12-11-2015
10:22 AM
- last edited on
03-27-2024
02:54 PM
by
Content Cleaner
Hello Danny,
You should use .ini file.
https://www.ni.com/docs/en-US/bundle/labview/page/configuration-files.html
And you should download Open G library they devellopt an amasing API wich allow you to directly write and read cluster into ini files.
12-11-2015 10:59 AM
I prefer to use XML for things like this as parsing it is simpiler, but really the file format does not matter.
You just have to save all your controls to a file and be able to read that back and restore them next time.
The file coud be as simple as a comma seperated values (.csv) text file as long as you save and restore them in the same order.
12-11-2015
04:51 PM
- last edited on
03-27-2024
02:55 PM
by
Content Cleaner
There is a caveat using XML file instead of .ini.
If you're changing your main cluster, you can't read old file.
With the .ini each element is define by key and sections. If an element is add or remove from the file, you still can read it with the same API.
dannyjhu there is a code example already developed.
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YILZCA4&l=en-US
Good luck.
03-27-2024 03:27 PM - edited 03-27-2024 03:27 PM
@sabri.jatlaoui wrote:
There is a caveat using XML file instead of .ini.
If you're changing your main cluster, you can't read old file.
This is not true, I have been maintaining a program for almost a decade that uses XML for configuration. I have added and removed sections of the cluster that is populated from reading the XML file more than once.
Sure the new version of the program will not run properly with an old XML file because there is missing information unless the XML config file was also updated. That will happen regardless of what file format you store your configuration.