sdynk02 Posted November 17, 2015 Share Posted November 17, 2015 (edited) $TimField = IniReadSectionNames(@DesktopDir & "\Data.ini") For $a = 1 To $TimField[0] $TimField1 = IniReadSection(@DesktopDir & "\Data.ini", $TimField[$a]) For $i = 1 To $TimField1[0][0] $Key = $TimFiled1[$i][0] $Value = $TimeField1[$i][1] MsgBox(0, "Section Name " & $a & " n" & $TimField[$a], "Key: " & $TimField1[$i][0] & @CRLF & "Value: " & $TimField1[$i][1]) Next Next MsgBox(0,"","Xong")$1 = FileOpen('save.ini') $2 = FileRead($1) $3 = StringSplit($2,@CRLF) For $i = 1 to $3[0] If $3[$i] <> '' Then $4 = _ExcelBookOpen($3[$i]) $5 = _ExcelReadSheetToArray($4, 1, 1) ;Starting on the 2nd Column;~ _ArrayDisplay($5) For $i = 1 to $5[0][1] $Compare = $5[1][$i] Next If $Compare = $Key Then Iniwrite(0,"","", $Value) EndIf Next I got stuck in this problem... I don't know how to explain clearly my problem but hope you guys read my code first !!!!I need to solve 2 casesCase 1 : If $Compare = $Key Then Iniwrite(0,"","", $Value)Case 2 : How can i read all data from $5 ???Thanks for reading my Topic. Data.iniFeel free to contact me for more information !!! Edited November 17, 2015 by sdynk02 Link to comment Share on other sites More sharing options...
czardas Posted November 17, 2015 Share Posted November 17, 2015 (edited) I instantly notice several problems. The following line is wrong:If $Compare = $Key Then Iniwrite(0,"","", $Value)0 is not a valid ini file name, section and key parameters have not been given valid names and this line should also be inside the second loop. Secondly you use the same variable $i as iteration count, so the value becomes corrupted in the first loop. You should use a different variable every time you enter a new loop (nested inside another) eg:For $i = 0 To 1 For $j = 0 To 1 ; Do something Next Next Edited November 17, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
sdynk02 Posted November 17, 2015 Author Share Posted November 17, 2015 I instantly notice several problems. The following line is wrong:If $Compare = $Key Then Iniwrite(0,"","", $Value)0 is not a valid ini file name, section and key parameters have not been given valid names and this line should also be inside the second loop. Secondly you use the same variable $i as iteration count, so the value becomes corrupted in the first loop. You should use a different variable every time you enter a new loop (nested inside another) eg:For $i = 0 To 1 For $j = 0 To 1 ; Do something Next NextI forgot to fix my code, actually it's Msgbox(0,"","",$Value), not Iniwrite. And Using Iniwrite is my purpose !!!! Link to comment Share on other sites More sharing options...
sdynk02 Posted November 17, 2015 Author Share Posted November 17, 2015 If you have free time, so Can you get into my pc to see what happens to understand more clearly about my code???. I'm using teamviewer for sure. I got somethings to ask you.Many Thanks. Link to comment Share on other sites More sharing options...
Jfish Posted November 17, 2015 Share Posted November 17, 2015 I forgot to fix my code, actually it's Msgbox(0,"","",$Value), not Iniwrite. And Using Iniwrite is my purpose !!!!You have flag, title, text, and timeout for the first four parameters of MsgBox. You have the value (text) in the timeout parameter. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
czardas Posted November 17, 2015 Share Posted November 17, 2015 If you have free time, so Can you get into my pc to see what happens to understand more clearly about my code???. I'm using teamviewer for sure. I got somethings to ask you.Many Thanks. No, but if I were to do that, I would go to the AutoIt help file and open it on the page with tutorials. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
sdynk02 Posted November 17, 2015 Author Share Posted November 17, 2015 No, but if I were to do that, I would go to the AutoIt help file and open it on the page with tutorials.I solved my problems. Anyway, tks for your help !!!! $1 = FileOpen('save.ini') $2 = FileRead($1) $3 = StringSplit($2,@CRLF) For $i = 1 to $3[0] If $3[$i] <> '' Then $4 = _ExcelBookOpen($3[$i]) $5 = _ExcelReadSheetToArray($4, 1, 1);~ _ArrayDisplay($5) $TimField = IniReadSectionNames(@DesktopDir & "\Data.ini") ;_ArrayDisplay($TimField) For $a = 1 To $TimField[0] $TimField1 = IniReadSection(@DesktopDir & "\Data.ini", $TimField[$a]) For $i = 1 To $TimField1[0][0];~ MsgBox(0, "Section Name " & $a & " n" & $TimField[$a], "Key: " & $TimField1[$i][0] & @CRLF & "Value: " & $TimField1[$i][1]) $6 = IniRead(@DesktopDir & "\Data.ini",$TimField[$a],'cohaykhong','Khong Co') Next Next For $i = 1 to $5[0][1] MsgBox(0,'',$6&'|'&$5[1][$i]) Next EndIf NextEndFunc Link to comment Share on other sites More sharing options...
czardas Posted November 17, 2015 Share Posted November 17, 2015 If the code does what you want, then that is a pure fluke. I still see you are reusing $i in multiple places before previous usage has finished. You are overloading this unfortunate variable which can only store one loop count at a time. You want it to store too much information. I showed you a solution above. operator64 ArrayWorkshop 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