04-07-2009 08:31 PM
Hi Folks
I would like to know how to add comments in the configuration or ini files before using configuration files vis.
That way I know what each line means to my colleagues during my absence.
Pls advise
Thanks
04-08-2009 08:25 AM
Hello Astroboy,
If you're reading .txt files and Open Config.VI, Read Key.VI etc. Then you can put a comment anywhere you want in the text file. Although for consistency, it's probably a good practice to put your comments between slashes.
\\This is a comment\\
I just tried this out and my config VI worked the same as always.
04-08-2009 08:30 AM
pallen wrote:Hello Astroboy,
If you're reading .txt files and Open Config.VI, Read Key.VI etc. Then you can put a comment anywhere you want in the text file. Although for consistency, it's probably a good practice to put your comments between slashes.
\\This is a comment\\
I just tried this out and my config VI worked the same as always.
Did you try updating any of the values in the file?
My experiments showed that LV handles reading the files just fine with comments but when the file is updated....... All comments are lost.
Has this changed?
What version of LV did you see this in?
Curious,
Ben
04-08-2009 09:35 AM
One thing I have done is to create a key named "Note", assuming that you do not have a control with that name. Then I just write the comments to that key. You can read them back the same way. If you have multiple comments, make the keys Note0, Note1, Note2, ...
The result is a file which is still human readable and seems to be fully compatible with the config file VIs.
Lynn
04-09-2009 08:56 AM
04-09-2009 09:18 AM
pallen wrote:
Hi Ben,
After reading your comment, I figured it was probably time to "insert foot in mouth" because I only actually tried reading from an .ini file that I'd added comments to.
Just before writing this reply though, I figured I'd better actually try it this time. I didn't expect it to work. But..it kinda seems to.
I opened my .ini in Notepad and added "\\This is a comment\\" in the middle of the file. Then, I opened my Save Config.VI and over wrote all the values in the .ini file.
I expected this would over write my comment. But it didn't. It's still exactly were I put it. But an equal sign and two quotations have been appended to the line right after the comment.
I tried adding more comments and over writing several times and the behavior seems consistent.
I'm using LabVIEW 8.5.1 on Win XP.
Excellent!
Double Kudos to you for teaching me this.
I had tried the old-school method of using a semi-colon at the end of each line.
The next time I'm asked I'll be coming back here.
Thank you!
Ben
02-03-2010 01:01 PM
Has anyone else got info on how to add comments to INI files that do not get stepped over when you write to INI files?
I tried the ";" and \\comment\\ methods and neither worked with Labview 8.6.1. Leave it to National Instrument to again not follow ";" industry standard convention and step all over how things should be done by accepted industry standards. I can't for the life of me figure out why National has to overwrite areas of the configuration INI files that the user is not writing to. What lousy coding standards and practices National. Shame on you. I see the same lousy coding standards in some of the example code they provide.