Verschiedene Zeilen einer TXT per GUI ändern

  • Hallo ich hab schon wieder ein prob ^^

    [autoit]

    #include <GUIConstants.au3>

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

    GUICreate("MeineGUI",250,200)
    GUISetState(@sw_show)

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

    $id_input1=GUICtrlCreateInput("Wert 1",21,30,171,20,-1,-1)
    $id_input2=GUICtrlCreateInput("Wert 2 ",20,80,171,20,-1,-1)
    $id_input3=GUICtrlCreateInput("Wert 3",20,130,171,20,-1,-1)

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

    While 1
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Then ExitLoop
    WEnd

    [/autoit]


    so weit bin ich jetz schonmal
    und jetz will ich das Werte einer TXT datei geändert werden
    z.b.
    Wert 1 soll in die zeile 7 etwas schreiben und das vorhandene löschen
    Wert 2 soll in die zeile 8 etwas schreiben und das vorhandene löschen
    Wert 3 soll in die zeile 9 etwas schreiben und das vorhandene löschen
    hoffe jemand kann mir helfen
    mfg

  • Zum Beispiel so:

    [autoit]

    #include <GUIConstants.au3>
    #Include <File.au3>

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

    Dim $afile
    _FileReadToArray("Test.txt",$afile)

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

    GUICreate("MeineGUI",250,200)
    GUISetState(@sw_show)

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

    $id_input1=GUICtrlCreateInput("Wert 1",21,30,171,20,-1,-1)
    $id_input2=GUICtrlCreateInput("Wert 2 ",20,80,171,20,-1,-1)
    $id_input3=GUICtrlCreateInput("Wert 3",20,130,171,20,-1,-1)

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

    While 1
    $msg=GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $id_input1 Then $afile[7] = GUICtrlRead($id_input1)
    If $msg = $id_input2 Then $afile[8] = GUICtrlRead($id_input2)
    If $msg = $id_input3 Then $afile[9] = GUICtrlRead($id_input3)
    WEnd

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

    _FileWriteFromArray("Test.txt",$afile,1)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
  • ok vielen dank aber wie sag ich das noch etwas davor geschrieben werden soll
    weil so funzt es nicht

    [autoit]

    If $msg = $id_input1 Then "aa" & $afile[7] = GUICtrlRead($id_input1)
    If $msg = $id_input2 Then "bb" & $afile[8] = GUICtrlRead($id_input2)
    If $msg = $id_input3 Then "cc" & $afile[9] = GUICtrlRead($id_input3)

    [/autoit]