erezlevi Posted January 18, 2008 Share Posted January 18, 2008 hi, can some one tell me why can't I put the values after striping them from the original string in the Array at the $e+10 position in the Array? the erez.txt file holds the following: erez1=king erez2=Quein erez3=prince erez4=servent #include <File.au3> #include <Array.au3> global $r, $u1 Dim $myArray[20] $i = "erez" $s = "1" $erez="c:\erez.txt" _FileReadToArray ($erez,$myArray) _ArrayDisplay ($myArray) For $o = 1 To 10 $e=_ArraySearch ($myArray,$i&$s,0,0,1,True) if $e > -1 Then $u1 = FileReadLine($erez, $e) $infou1 = StringSplit($u1, "=") $u1 = $infou1[2] call ("levi",$u1) Else call ("levi",$u1="") EndIf $s=$s+1 Next func levi ($m1) _ArrayInsert ($myArray,$e+10,$m1) EndFunc _ArrayDisplay ($myArray) Link to comment Share on other sites More sharing options...
erezlevi Posted January 18, 2008 Author Share Posted January 18, 2008 hi, can some one tell me why can't I put the values after striping them from the original string in the Array at the $e+10 position in the Array? the erez.txt file holds the following: erez1=king erez2=Quein erez3=prince erez4=servent #include <File.au3> #include <Array.au3> global $r, $u1 Dim $myArray[20] $i = "erez" $s = "1" $erez="c:\erez.txt" _FileReadToArray ($erez,$myArray) _ArrayDisplay ($myArray) For $o = 1 To 10 $e=_ArraySearch ($myArray,$i&$s,0,0,1,True) if $e > -1 Then $u1 = FileReadLine($erez, $e) $infou1 = StringSplit($u1, "=") $u1 = $infou1[2] call ("levi",$u1) Else call ("levi",$u1="") EndIf $s=$s+1 Next func levi ($m1) _ArrayInsert ($myArray,$e+10,$m1) EndFunc _ArrayDisplay ($myArray) sorry guys, found the problem + I have decided to use a second Array instead here is the code: #include <string.au3> #include <File.au3> #include <Array.au3> local $r, $u1 global $e Dim $myArray[20] Dim $yuArray[20] $i = "erez" $s = "1" $erez="c:\erez.txt" _FileReadToArray ($erez,$myArray) _ArrayDisplay ($myArray) for $o=1 to 5 $e=_ArraySearch ($myArray,$i&$s,0,0,1,True) if $e > -1 Then $u1 = FileReadLine($erez, $e) $infou1 = StringSplit($u1, "=") $u1 = $infou1[2] call ("levi",$u1,$e) Else call ("levi",$u1="") EndIf $s=$s+1 Next func levi ($m1,$y) _ArrayInsert ($yuArray,$y,$m1) EndFunc _ArrayDisplay ($yuArray) Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 Are you sure you want to use a text file? If it's just entries with a value, then you should maybe try using the Ini functions(IniWrite, IniRead, etc.). :} Link to comment Share on other sites More sharing options...
erezlevi Posted January 18, 2008 Author Share Posted January 18, 2008 Are you sure you want to use a text file? If it's just entries with a value, then you should maybe try using the Ini functions(IniWrite, IniRead, etc.). :}It isn't what I meant, the Text file is the outcome of another application. I need to get the values from the text for each line holds the:erez1="lskdjflsdkjf"lskjfdlskdjflkjsdlfkjdslkjfashdglashgerez2="blablablalba"without the "erez1" or "erez2" initials, so the stringsplit helps with that and the arrays helps with getting the lines where "erez1" and "erez2" are. so if I change their value using _filewritetoline I know what line to change for erez1 and for erez2. Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 Oh, okidok. 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