Mein Problem? Der Code will eine Zeile nicht ersetzen! (Könnt es so verwenden wie es dasteht)

  • Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <GUIConstants.au3>
    #include <Array.au3>

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

    #include <File.au3> ;!!!!!!!!!!!!!!!!!!!

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

    If FileExists(@ScriptDir & '\Behälter.txt') Then
    Else
    $string4 = "Behälter.txt"
    FileWrite($string4, "Loot-Beutel" & @CRLF & "Tänke-Beutel" & @CRLF & "Reagenzien" & @CRLF & "Schuppen&Knochen" & @CRLF & "Samen-Beutel" & @CRLF & "Zauberrollen" & @CRLF & "Edelstein-Beutel" & @CRLF & "Fell-Beutel" & @CRLF & "Sonstiges" )

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

    EndIf
    If FileExists(@ScriptDir & '\Infoanlagen.txt') Then
    Else
    $string5 = "Infoanlagen.txt"
    FileWrite($string5, "Zur reinen Information" )
    Dim $Angelegt = 1
    EndIf
    Dim $Angelegt = 0
    If FileExists(@ScriptDir & '\Find.txt') Then
    Else
    $string6 = "Find.txt"
    FileWrite($string6 , "set %findTypen " & @CRLF & "set %findena " & @CRLF & "set %findenc " & @CRLF & "set %findend " & @CRLF & "set %findene " & @CRLF & "set %findenf " & @CRLF & "set %findeng " & @CRLF & "set %findenh " & @CRLF & "set %findeni " & @CRLF & "set %findenj")
    Dim $Angelegt = 1
    EndIf
    $string6 = "Find.txt"

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

    #Region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\busch.gaiaakku\desktop\skripte für pergon\sicherung der forms mit koda\form4includesortierenerweitern.kxf
    $Form2IS = GUICreate("Items erweitern", 359, 233, 193, 125)
    GUISetFont(8, 800, 0, "MS Sans Serif")
    GUISetBkColor(0x316AC5)
    $Label2 = GUICtrlCreateLabel("Item Name: ", 25, 50, 86, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Input1IS = GUICtrlCreateInput("", 120, 50, 200, 21)
    $Input2IS = GUICtrlCreateInput("", 120, 90, 40, 21)

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

    $Label3 = GUICtrlCreateLabel("Typ:", 25, 90, 35, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("Ausnahmslos nur 3 Zeichen!", 120, 120, 164, 17)
    $Combo1IS = GUICtrlCreateCombo("", 120, 150, 200, 25)
    If FileExists(@ScriptDir & '\Behälter.txt') Then
    $file1T = FileOpen ( "Behälter.txt", 0 )
    If $file1T = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    $AllLines1T = ""
    While 1
    $line1T = FileReadLine($file1T)
    If @error = -1 Then
    StringTrimRight($AllLines1T, 1)
    ExitLoop
    EndIf
    $AllLines1T &= $line1T &"|"
    Dim $AllLines21T = $AllLines1T
    WEnd
    Else
    MsgBox(4096,"Warnung" , "Behälter.txt does NOT exists")
    EndIf
    GUICtrlSetData($Combo1IS, $AllLines21T)
    $Label5 = GUICtrlCreateLabel("Wohin?", 25, 150, 55, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Back = GUICtrlCreateButton("Back", 120, 180, 80, 25, 0)
    GUICtrlSetCursor (-1, 0)
    $Button2IS = GUICtrlCreateButton("Einfügen", 240, 180, 80, 25, 0)
    GUICtrlSetCursor (-1, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    MsgBox(64, "","Hir werden neue Items in das Skript aufgenommen. Die für alle Chars gelten!" , 3 )

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button2IS
    ;~ "set %findTypen"
    ;~ "set %findena"
    ;~ "set %findenc"
    ;~ "set %findend"
    ;~ "set %findene"
    ;~ "set %findenf"
    ;~ "set %findeng"
    ;~ "set %findenh"
    ;~ "set %findeni"
    ;~ "set %findenj"

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

    Dim $LB = "Loot-Beutel"
    ;~ "Tänke-Beutel"
    ;~ "Reagenzien"
    ;~ "Schuppen&Knochen"
    ;~ "Samen-Beutel"
    ;~ "Zauberrollen"
    ;~ "Edelstein-Beutel"
    ;~ "Fell-Beutel"
    ;~ "Sonstiges"

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

    $Typ = GuiCtrlRead($Input2IS )
    $TypG = StringUpper ( $Typ )
    $InhaltCombo1IS = GUICtrlRead ($Combo1IS )
    If FileExists(@ScriptDir & '\Find.txt') Then
    $Find = FileOpen ( "Find.txt", 0 )
    If $Find = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf

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

    $AllLinesFind = ""
    While 1
    $lineFind = FileReadLine($Find)
    MsgBox(0, "Der neue String", $lineFind )
    If @error = -1 Then
    StringTrimRight($AllLinesFind, 1)
    ExitLoop
    EndIf
    If ( $LB == $InhaltCombo1IS ) Then
    $result = StringInStr ( $lineFind, "set %findena " )
    If ( $result == 1 ) Then
    Dim $Temp = $lineFind & "_" & $TypG
    $Ersatz = StringReplace ( $Temp , " _" , " " )
    MsgBox(0, "Der neue String", $Ersatz)
    $Find = FileOpen ( "Find.txt", 1 )
    _ReplaceStringInFile($Find , $lineFind, $Ersatz )
    FileClose($Find)
    Exit
    EndIf
    EndIf
    WEnd
    Else
    MsgBox(4096,"Warnung" , "Find.txt.txt does NOT exists")
    EndIf
    EndSwitch
    WEnd

    [/autoit]


    Es soll eine Type zb "ERT" an die Zeile "set %findena" angefügt werden, die sich in der Find.txt befindet.
    Wo ist dr Fehler bin ich zu blöd?

    Hab den Fehler gefunden Phatangabe war inkoreckt.
    $retval = _ReplaceStringInFile($string6 , $lineFind, $Ersatz )


    ^^ Kein Bot. Das ist eine Oberfläche für eine Übersetztung eines Skriptes das mansche funktionen die Autoit hat nicht unterstüzt. Es ist eine Sehr alte Programiersprache^^. mit goto und gosub zb. Man muss immer manuel was eintragen direckt im Skript. Das will ich mit der Oberfläche Benutzerfreundlich machen. ^^ Bot bringt mir nix.

    4 Mal editiert, zuletzt von Skar (15. September 2009 um 15:05)