Array in for in Schleife

  • Hallo,

    ich habe eine einfache Abfrage um eine Ini auszulesen, nur gibt es immer einen Error bei for $t = 1 to $program[0][0]
    for $t = 1 to $program^ ERROR, per Arraydisplay sehe ich die Anzahl = 8 in $program[0][0, setze ich diese anstelle $program[0][0]
    ein, läuft die Abfrage durch

    [autoit]


    #include<Array.au3>
    Local $program[1][10]
    Local $dateiname = @WorkingDir & "\test.ini"
    Local $ininames = IniReadSectionNames($dateiname)
    Local $program = IniReadSection($dateiname, $ininames)
    for $elements in $ininames
    $program = IniReadSection($dateiname, $elements)
    for $t = 1 to $program[0][0]
    if @error then ExitLoop
    ConsoleWrite($program[$t][0]&"="&$program[$t][1]&@CRLF)
    next
    Next

    [/autoit]

    Wo liegt mein Fehler, ich bitte um Hilfe!!!

    Einmal editiert, zuletzt von kunstlust (20. Juli 2011 um 18:53)

  • Hallo kunstlust,

    mach es so:

    [autoit]

    #include<Array.au3>
    Local $dateiname = @WorkingDir & "\test.ini"
    Local $ininames = IniReadSectionNames($dateiname)
    ;_ArrayDisplay($ininames)
    For $i = 1 to $ininames[0]
    $program = IniReadSection($dateiname, $ininames[$i])
    ; _ArrayDisplay($program)
    For $t = 1 To $program[0][0]
    If @error Then ExitLoop
    ConsoleWrite($ininames[$i] & " => " & $program[$t][0] & "=" & $program[$t][1] & @CRLF)
    Next
    Next

    [/autoit]

    und es klappt,

    mfg autoBert