WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

System INI and INI File Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Display Items in an INI file and Allow for User Selection

Keywords:    IniItemizePvt   AskItemList   IniReadPvt

Question:

Is it possible to read a section of an ini file and display the contents of what is to the right of the equal sign as the result in an ItemBox. And letting the user select one of the displayed options. I have been able to display what is to the left of the equal sign with the IniItemizedPvt Function. Any help you can provide is greatly appreciated.

Answer:

Yes, but you have to do an IniReadPvt for each for the keys that IniItemize returns and build your own string to display.

In the example below, note that you will need to provide the full path to your INI file, if it is not located in the \Windows or \Windows\System subdirectory. Otherwise, the function will return a null string since it can't find the INI file.

So your script would look something like...

inifile="www-prod.ini"
iniall=IniItemizePvt("",inifile) ; Get sections in win.ini
inisection=AskItemList("Choose a section",iniall,@tab,@sorted,@single)
inikeywords=IniItemizePvt(inisection,inifile)

inicount=ItemCount(inikeywords,@tab)

line=""
for xx=1 to inicount
   inicurrent=ItemExtract(xx,inikeywords,@tab)
   inivalue=IniReadPvt(inisection,inicurrent,"???",inifile)
   line=strcat(line,inicurrent," = ",inivalue,@tab)
next

AskItemList("The Ini Section",line,@tab,@sorted,@single)

Article ID:   W13334
Filename:   Display Items in an INI file in an Itembox.txt
File Created: 1999:04:15:16:53:20
Last Updated: 1999:04:15:16:53:20