Problem mit Inireadsection und arrays!

  • Hai leute,
    Kann mir einer verraten wieso dieses sciprt nicht geht?

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $iniFrage = IniReadSection("Data.txt", "Frage")
    $iniantwort1 = IniReadSection("Data.txt", "Antworten")

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Abstimmung", 188, 132, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox($iniantwort1[1][1], 8, 32, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox($iniantwort1[1][2], 8, 64, 97, 17)
    $Label1 = GUICtrlCreateLabel($iniFrage[1][1], 8, 8, 175, 17)
    $Button1 = GUICtrlCreateButton("Abstimmen", 8, 96, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Abrechen", 96, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    Die data.txt datei sieht so aus:

    Spoiler anzeigen

    [Frage]
    =Wird morgen jemand sterben?
    [Antworten]
    =Ja nein

    MFg CF gaming

  • geht nich

    Edit: Es kommt immer diese fehlermeldung: C:\Users\Schwemmlein\Desktop\Sciprt\Abstimmung.au3 (11) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
    $Checkbox2 = GUICtrlCreateCheckbox($iniantwort1[1][2], 8, 64, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox(^ ERROR
    ->14:48:14 AutoIT3.exe ended.rc:1
    >Exit code: 1 Time: 1.487

  • @SklavenTrieb, wenn man keine Ahnung hat, einfach mal still sein, und weiter AutoIt lernen, ok ?
    Ob .ini oder .txt oder .autoitDE oder .ich oder .? oder .* ist wurst egal

    @CF , eine Ini ist so Aufgebaut:

    [Section]
    Key = Wert

    Und wenn es keinen Key gibt, tja ...
    Also mach die Data.txt so:

    [Frage]
    1=Wird morgen jemand sterben?
    [Antworten]
    1=Ja nein

    Und jetzt könntest du z.b. noch machen:

    [Frage]
    1 = Wird morgen jemand sterben ?
    2 = Wird morgen jemand geboren ?
    [Antworten]
    1 = Ja
    2 = Nein

    €: Guck mal in die Hilfe:

    [autoit]


    $IniRead = InIReadSection("MyIni.ini", "Section")
    #cs
    $InIRead gibt eine 2D Array zurürck:
    $InIRead[n][0] = Key
    $IniRead[n][1] = Value
    Das heisst du musst bei $IniRead[0][1] beginnen ;):
    #ce

    [/autoit][autoit][/autoit][autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    $iniFrage = IniReadSection("Data.txt", "Frage")
    $iniantwort1 = IniReadSection("Data.txt", "Antworten")

    [/autoit][autoit][/autoit][autoit]

    $Form1 = GUICreate("Abstimmung", 188, 132, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox($iniantwort1[0][0], 8, 32, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox($iniantwort1[0][1], 8, 64, 97, 17)
    $Label1 = GUICtrlCreateLabel($iniFrage[0][1], 8, 8, 175, 17)
    $Button1 = GUICtrlCreateButton("Abstimmen", 8, 96, 75, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Abrechen", 96, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit]

    Es gibt sehr viele Leute, die glauben. Aber aus Aberglauben.
    - Blaise Pascal

  • Sorry ... Aber Mattthias wenn du der Held in AutoIt bist dann kannste doch bestimmt mein Problem auch beantworten oder?