Page 1 of 1

Reading a .INI file

PostPosted: Wed May 13, 2015 7:52 pm
by mcnin
I can't find any info on how to read values from a .ini file, so I was hoping someone could point me in the right direction.

Here is what I did.
First I made a file called 'values.ini'
The file contents look like this:
[values]
somedata=900

Then I set GOverlay to read the key somedata in section [values]. When I go to sensors, I see INI: Keys & somedata, but when I put that on the screen, nothing shows up. Shouldn't my value appear? Am I doing this wrong? Any help would be great or maybe a sample of a simple .ini file that I can use as a starting point.

Re: Reading a .INI file

PostPosted: Wed May 13, 2015 8:01 pm
by TheLaGmAn
For a file with the contents:
Code: Select all
[values]
somedata=900
someotherdata=100

Your settings on Sensors > INIData should look like this, one setting per line:

Code: Select all
Enabled
C:\path\to\your\ini\file.ini
values
somedata,someotherdata


Hit save, go to the LCDSysInfo Tab, add the somedata element in the "INI: Keys" sensors list, click on the element added and make sure that the width of the element has enough space to show the value, by default the text "900" should fit.

It should work, if it doesnt, look in the Debug tab and post the contents here to see if there is any error.

Re: Reading a .INI file

PostPosted: Wed May 13, 2015 8:25 pm
by mcnin
Thank you so much. I was able to get it working. Turns out I had not specified the full path to the .ini file in GOverlay. So when I followed your instructions, which included the full path, I got it working. It's always the simplest of oversights that get you stuck. :D
Also, thanks for confirming the layout/syntax of the .ini file.