AndreasNWWWWW Posted July 12, 2018 Posted July 12, 2018 (edited) Hi, i'm curious if this is even possible, i want to do an action if the ini file contains current values under a section. for my test i'm looking for 100,200,300,400,500 and if any of those excits i want to pop a msgbox with the number in the section. i can in my example find one, but it does not check everyone. why? what am i missing? Local $iscore810[5] = [100,200,300,400,500] Local $iMax800 = 5 While 1 ;~ Send("{pause}") ;;func les ini fil $var = IniReadSection("Area.ini", "modus") If @error Then MsgBox(4096, "Error", "Unable to read section.") Else For $number = 1 To $var[0][0] If $var[$number][1] == $iscore810[3] Then MsgBox($MB_SYSTEMMODAL, "FAnt den på", $var[$number][0], 5) EndIf Next EndIf exit WEnd Edited July 14, 2018 by AndreasNWWWWW taggs
AutoBert Posted July 12, 2018 Posted July 12, 2018 1 hour ago, AndreasNWWWWW said: what am i missing? Correct data in inifile. Test changed script: #include <MsgBoxConstants.au3> #include <Array.au3> Local $iscore810[5] = [100, 200, 300, 400, 500] Local $iMax800 = 5 If Not FileExists("Area2.ini") Then IniWrite("Area2.ini","Modus","Test","400") ;While 1 $var = IniReadSection("Area2.ini", "modus") If @error Then MsgBox(4096, "Error", "Unable to read section.") Else _ArrayDisplay($var) For $number = 1 To $var[0][0] If $var[$number][1] == $iscore810[3] Then MsgBox($MB_SYSTEMMODAL, "FAnt den på", $var[$number][0], 5) EndIf Next EndIf Exit ;WEnd it's just for demonstration when inifile holds correct data the MsgBox appears.
AndreasNWWWWW Posted July 19, 2018 Author Posted July 19, 2018 ;Thanks! helped me alot, but still abit lost. ;in my code i need to check if checksum excits, and if so i need it to rewrite that line in the ini file. Local $arr[9] = [1218844893, 3651583250,681492513,185647069,2160709610,3972714752,3059395736,4086222246,2699877049] ;this works: If $var[$number][1] == 1218844893 Then IniWrite("arenatest.ini","posisjon",$var[$number][0],"500-Paid") endif ;this does not: If $var[$number][1] == $arr[9] Then IniWrite("arenatest.ini","posisjon",$var[$number][0],"500-Paid") endif i could just do alot of manual typing those checksums, but harder to change, reason i want it in an array so i can just pull it off the excel file direcly.
AndreasNWWWWW Posted July 19, 2018 Author Posted July 19, 2018 nvm this post above, when swapping the 9 number in array to 8, it worked why does this number to be one lower?
dmob Posted July 19, 2018 Posted July 19, 2018 AFAIK == is used for string comparison. Try a single =
Subz Posted July 19, 2018 Posted July 19, 2018 why does this number to be one lower? Your array is 0 based, i.e. it counts as 0, 1, 2, 3, 4, 5, 6, 7, 8 not 1, 2, 3, ...9 Also what you could do is something like: Local $iscore810[5] = [100,200,300,400,500] Local $iMax800 = 5 For $i = 0 To UBound($iscore810) - 1 If IniRead("Area.ini", "modus", $iscore810[$i], "") = "" Then ContinueLoop MsgBox(4096, "Number found", "Number# " & $iscore810[$i]) Next
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