Jump to content

Recommended Posts

Posted (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 by AndreasNWWWWW
taggs
Posted
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.

Posted
;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. 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...