sykes Posted November 21, 2004 Share Posted November 21, 2004 OK ... I've got a script that loops through a file and checks for the existence of a specific combination (i.e. it checks for the string having a letter followed by a colon ) It works perfectly but i need to have the results add to the last instance of one being found For example, it checks for the existence of "V:" in the file I need it to return the value and next time around return the first value and the second value, etc, etc. Example: 1st instance = "value1" 2nd instance = "value1value2" I get the values i need but upon the 2nd and subsiquent instances it only shows those results Heres what i have in a simplified version: $file = FileOpen(@ScriptDir & "\settings.ini", 0) $cnt = 0 $num = 0 While 1 $cnt = $cnt + 1 $line = FileReadLine($file, $cnt) if @error = -1 then exitloop if stringinstr($line, "V:") Then $num = $num + 1 $line = StringTrimLeft($line, 3) $line = StringTrimRight($line, 1) ; need to add results here and continue loop EndIf WEnd The settings.ini in question has sections in the following format: [V:value1] [V:value2]etc, etc We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted November 21, 2004 Share Posted November 21, 2004 I'm confused.... Why don't you use IniRead? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
sykes Posted November 21, 2004 Author Share Posted November 21, 2004 (edited) I want to be able to get all of the sections that are in that format (i.e. find all sections that are like [V:value1]) without hard coding it into a program. This way more sections can be added to the ini and the program will find these and allow me to add them dynamically to a dropdown list so they can be selected Am I adding to the confusion? Edited November 21, 2004 by psichosis We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted November 21, 2004 Share Posted November 21, 2004 Is the whole reason for Example: 1st instance = "value1"2nd instance = "value1value2"for adding the items dyntamically to a combo box?I'm taking a stab in the dark here:$file = FileOpen(@ScriptDir & "\settings.ini", 0) $cnt = 0 $num = 0 Dim $allResults While 1 $cnt = $cnt + 1 $line = FileReadLine($file, $cnt) if @error = -1 then exitloop if stringinstr($line, "V:") Then $num = $num + 1 $line = StringTrimLeft($line, 3) $line = StringTrimRight($line, 1) ; need to add results here and continue loop $allResults = $allResults & $line EndIf WEnd MsgBox(4096, "All Results", $allResults) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
sykes Posted November 21, 2004 Author Share Posted November 21, 2004 (edited) That did it ... I knew I was missing something simple Excuse me while I go rough myself up and put on the Dunce hat Thanks a Ton CS Edited November 21, 2004 by psichosis We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted November 21, 2004 Share Posted November 21, 2004 That did it ... I knew I was missing something simpleExcuse me while I go rough myself up and put on the Dunce hat Thanks a Ton CS<{POST_SNAPBACK}>No problem. I thought surely I must be missing something. The fix can' be that simple, can it? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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