Jump to content
Sign in to follow this  
jcampbell

INI read and generating a list

Recommended Posts

jcampbell

Hi all,

It has been a few years since I ventured into AutoIT scripting.

I am trying to use an ini that I populate to create a list of variables that will then be used in a FileWriteLine to create a CMD file.  I know that sounds a little odd but I am using the scripting and GUI of AutoIT to generate a CMD file that gets used for some automated process.

My script so far will create the CMD based on information stored in an INI file that the user selects.  What I need to be able to do is when the user selects a check box it reads the desired ini file and using the values stored under the key create a list that I can then loop through.  So for example if I have an ini that is structured like the following

[FishType]

1=Crappie

2=Trout

3=Brass

4=WhiteBass

I would the user to select a box called Bass that will basically select the items 3 and 4 and add those into a set of variables that I can then use in my CMD file.

I am probably not explaining this the best but I am not sure how to word it. I am using GUICtrlSetData to populate a set of combo boxes that allow the user to select the correct ini and the key heading that will be used.  A third combo box is present for a single selection of data but I also need them to be able to read the items under the key and basically batch the desired items based on a selection filter (in my example this was bass).

I can provide my script and a sample ini file off line if needed but I would rather not post it all live.  I have been trying to use iniread but I can seem to get my head around how to loop through the list.

Thanks

Share this post


Link to post
Share on other sites
mikell

It seems that a sqlite database should be better for your needs, as it looks like a search engine

Indeed what you want to do requires to read *all* the ini files, then organize the amount of data to be able to loop through

Using a DB would be both quicker and more efficient

If you keep on doing the hard work, you need the 2 funcs Starg mentioned, and for each ini build a 2D array with ini name in 1st col, section name in 2nd col, keys in 3rd col, values in 4th col. You should then be able to get the info you want by looping through the 4th col, anyway... good luck

Edited by mikell

Share this post


Link to post
Share on other sites
jcampbell

Thanks guys,  Mike I would agree that a database would have been better. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×