smasher953 Posted December 2, 2004 Share Posted December 2, 2004 I've been playing around all morning trying to do this and I'm getting no where fast. I'm trying to read an entire .INI file into a multidimensional array. The size of the .INI file is different every time the file will be read. Here's a sample of the .INI contents:[COSMI]LastFound=11/29/2004CountFound=2LastRemoved=11/29/2004CountRemoved=1[WebDialer]LastFound=11/29/2004CountFound=3LastRemoved=11/29/2004CountRemoved=2[AdGoblin]LastFound=11/29/2004CountFound=2LastRemoved=11/29/2004CountRemoved=1[Adtomi.YahooStocks]LastFound=12/1/2004CountFound=7[blazeFind.SearchEnhancer.ISTbar]LastFound=11/29/2004CountFound=2LastRemoved=11/29/2004CountRemoved=1[ClearSearch.Net]LastFound=11/30/2004CountFound=3LastRemoved=11/30/2004CountRemoved=4[CoolWWWSearch.008k]LastFound=11/29/2004CountFound=2LastRemoved=11/29/2004CountRemoved=1I'd like each "[*]" section to be put into a row, and then each LastFound, CountFound, LastRemoved, CountRemoved put into a seperate column in that row. Any quick and easy ways to do this effectively? I've search the forum and found some things, but nothing to specifically help me out. --greg Link to comment Share on other sites More sharing options...
scriptkitty Posted December 2, 2004 Share Posted December 2, 2004 (edited) This is one way to do it, if your data stays in this format. $file="test.ini" $filelines=Fileread($file,filegetsize($file)) $counter=StringSplit($filelines,"[") $filelines=StringSplit(StringReplace(StringReplace($filelines,@lf,@cr),@cr&@cr,@cr),@cr) $counter=$counter[0]-1 Dim $items[$counter][5] $c=-1 for $i=1 to $filelines[0] Select Case StringLeft($filelines[$i],1)="[" $c=$c+1 $items[$c][0]=$filelines[$i] Case StringLeft($filelines[$i],9)="LastFound" $items[$c][1]=$filelines[$i] Case StringLeft($filelines[$i],10)="CountFound" $items[$c][2]=$filelines[$i] Case StringLeft($filelines[$i],11)="LastRemoved" $items[$c][3]=$filelines[$i] Case StringLeft($filelines[$i],12)="CountRemoved" $items[$c][4]=$filelines[$i] EndSelect next for $i=0 to $counter-1 MsgBox(1,$items[$i][0],$items[$i][1] &@cr& $items[$i][2] &@cr& $items[$i][3] &@cr& $items[$i][4]) Next Edited December 2, 2004 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
smasher953 Posted December 3, 2004 Author Share Posted December 3, 2004 That worked! I was missing 1 thing out of it....Thanks for the help scriptkitty! --greg Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now