LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comments inside INI-File?

Hi,how can i insert comments into an INI-file? When i use the ';' labview add everytime a '=' after the comment.Can I also insert a blank line between two sections for better viewing???RegardsHenrik
0 Kudos
Message 1 of 17
(30,758 Views)
Henrik,

If you read the fine print of the help documentation, you will find that
the LabVIEW INI file functions are incompatible with comments. The can read
the INI files OK assuming you don't have comments that look like statements
(having "=" signs in them), but LabVIEW cannot write to INI files with comments.
The comments will get jumbbled up as you have discribed. By the way, it
would be nice if someone rewrote the INI file functions in LabVIEW to allow
commenting in the files. Hint, Hint, wink, wink... NI are you listening!

-Jim

Henrik Skupin wrote:
>>>Hi,>

how
can i insert comments into an INI-file? When i use the ';' labview>add everytime
a '=' after the comment.>


Can I also insert a blank line between two sections
for better viewing???>

Regards>
Henrik>

Message 2 of 17
(30,753 Views)
I wrote my own ini file reader-writer which uses standard ini file format. I
did this to eliminate the over head of all the NI ini functions which are added
to a VI when using a NI ini function. I never checked my vi's if they can
support commenting, but as they are only text processing vi's it should be
possible. That was my solution to the ini control.

Henry
0 Kudos
Message 3 of 17
(30,753 Views)
Henry Coulter wrote:

> I wrote my own ini file reader-writer which uses standard ini file format. I
> did this to eliminate the over head of all the NI ini functions which are added
> to a VI when using a NI ini function. I never checked my vi's if they can
> support commenting, but as they are only text processing vi's it should be
> possible. That was my solution to the ini control.
>
> Henry

Why not simply have a key (string) that has the comment ??
Like comm1="This is the comment #1"

It may not be elagant but then again it IS platform independant
and everything is provided already.
If you wnat to use LV to read and write the comments then this is
the way to go. By the way you can have multiple keys with the same
name (even in the same sect
ion). The INI VIs dont care. They will
grap the first match and ignore all others, at least in my UNIX box anyway.

I agree that the ini files could be improved, but then again they
are simply text files with some fancy tools.
0 Kudos
Message 4 of 17
(30,754 Views)

I just came over this thread as I was searching for the same info.

 

Seems like this information is not valid anymore, I just found out that LabVIEW 8.2.1 can deal with empty lines and ";" comment lines, even if they contain a "=".

 

Regards,

 

Stefan

0 Kudos
Message 5 of 17
(30,357 Views)
However, if you include the ini file of the executable in a project, all the empty lines are removed when the application is build! Don't know what happens to comments.


Regards,


Wiebe.
Message 6 of 17
(30,318 Views)

Hi Wiebe,

you are right - I didn't try that. I needed the ini file for configuring a realtime application's analog channels and didn't always want to retype all the voltage settings. So just having all of them there and only uncommenting the needed one worked perfectly...

Regards,

Stefan

0 Kudos
Message 7 of 17
(30,317 Views)
Hmm...I'm butting my head against this same problem. I'm running 8.2 but the config file vi's do not seem to properly handle lines beginning with ";", i.e. they're not considered comments.

Personally I'd like to be able to configure the config-file VIs so that I can decide what character defines a comment (I'm a  unix guy, I like # for comments in config files!).


0 Kudos
Message 8 of 17
(30,213 Views)
I have worked on systems where one of the Sections was called "Part Type". The elements of that (Part0, Part1, Part2,...) were used to populate a ring control. The selection of the ring by the operator was used to select another Section where the parameters for that part were stored. A default section was also included and its values were used until the operator selected a particular part. An edited excerpt is below:

[Part Types]
Part1="Ultra II"
Part2="Ultra III"
Part3="Basic I"
Part4="Basic II"
[Settings]
Impedance High Limit=30.000000
Impedance Low Limit=10.000000
Power High Limit=30.000000
Power Low Limit=10.000000
Delay Time=15.000000
[Ultra II]
Impedance High Limit=29.000000
Impedance Low Limit=10.000000
Power High Limit=30.000000
Power Low Limit=10.000000
Delay Time=15.000000


I have also uses a Section called [Notes] with values Note1="anything"
Note2="something else"

I have not checked the behavior with a built application, but I think this should survive. However, this does not serve your needs for commenting out a line here or there.

Lynn
Message 9 of 17
(30,190 Views)
Well, not seeing any elegant solution to the issue I just went ahead and created my own solution. It's not horribly pretty, but here's what I did:

  • Created a copy of Config.llb, called it gbConfig.llb (my initials).
  • Created a little vi called "Remove Comments.vi" that scans through a string and removes any characters following an arbitrarilly defined comment character up to a newline character.
  • In gbConfig.llb, edited "String To Config Data.vi". Inserted my "Remove Comments.vi" at the very beginning.
I'm not fond of my "Remove Comments.vi" as it's a bit brutish, but the regular expression capability of LabView doesn't seem up to the task (I could do it with a one line sed or perl script...sigh).

Hopefully I've coerced the bulletin board into attaching my modified llb.




Message 10 of 17
(30,156 Views)