Kleine Ini. Problem

  • Moin Mojn,

    liebe Community ich meld mich ma wieder mit einem kleineren Problem..
    Ich arbeite seit gestern Abend mit IniWrite und IniRead und find .ini Dateien auszulesen sehr nützlich also hab ich mir mal gedanken gemacht was man alles machen könnte..

    und so kam ich auf die Idee eine Art Passwort Tool zu schreiben, mein Problem ist nur das der Eintrag aus Input1 nicht in die Ini übernommen wird, acchhh was red ich überhaupt so lange hier der Quellcode:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $read1 = GuiCtrlRead($Input1)
    $read2 = GuiCtrlRead($Input2)

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

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

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

    Case $Button1
    If $read1 = $read2 then _correct()
    If $read1 <> $read2 then MsgBox(0,"","Passwörter stimmen nicht überein")

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

    Case $Button2
    $readini = IniRead( "pw.ini", "Password", "Password", "")
    MsgBox(0,"Informationen","Ihr aktuelles Password lautet:" &$readini)

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

    EndSwitch
    WEnd

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

    Func _correct()
    Iniwrite ("pw.ini","Password","Password",$read1)
    MsgBox (0,"","Succesfull")

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

    EndFunc

    [/autoit]
    Code
    [Password]
    Password=


    Das steht in Meiner Ini


    und hier so mal nebenbei die Password Controll:

    [autoit]

    $pfad = "pw.ini"
    $read = IniRead ($pfad, "Password", "Password", "")
    $write = InputBox ("","","")
    If $read = $write then MsgBox(0,"","Pw Correct")
    If $read <> $write then MsgBox(0,"","Pw False")
    Exit

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


    Ich hoffe das jemand meinen Fehler finden & beheben kann


    MFG n3v

  • Mach mal die beiden GUICtrlRead() in die $Button1 switch-Abfrage, also

    [autoit]


    Case $Button1
    $read1 = GuiCtrlRead($Input1)
    $read2 = GuiCtrlRead($Input2)
    If $read1 = $read2 then _correct()
    If $read1 <> $read2 then MsgBox(0,"","Passwörter stimmen nicht überein")

    [/autoit]
  • Ahja vielen Dank euch beiden..

    allerdings wird Der Wert der InputBox immer noch nicht in die Ini Datei geschrieben

  • Doch, wird er. Die Änderung von Sprenger120 ist leider nicht korrekt. $read1 ist kein Control und muss/kann deshalb nicht ausgelesen werden. Die IniWrite Zeile also so lassen wie sie war.

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

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

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

    Case $Button1
    If GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
    _correct()
    Else
    MsgBox(0, "", "Passwörter stimmen nicht überein")
    EndIf

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

    Case $Button2
    $readini = IniRead("pw.ini", "Password", "Password", "")
    MsgBox(0, "Informationen", "Ihr aktuelles Password lautet:" & $readini)

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

    EndSwitch
    WEnd

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

    Func _correct()
    IniWrite("pw.ini", "Password", "Password", GUICtrlRead($Input1))
    MsgBox(0, "", "Succesfull")
    EndFunc ;==>_correct

    [/autoit]
  • Versuch mal so

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $read1 = GuiCtrlRead($Input1)
    $read2 = GuiCtrlRead($Input2)

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

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

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

    Case $Button1
    $read1 = GuiCtrlRead($Input1)
    $read2 = GuiCtrlRead($Input2)
    If $read1 = $read2 then _correct()
    If $read1 <> $read2 then MsgBox(0,"","Passwörter stimmen nicht überein")

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

    Case $Button2
    $readini = IniRead( "pw.ini", "Password", "Password", "")
    MsgBox(0,"Informationen","Ihr aktuelles Password lautet:" &$readini)

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

    EndSwitch
    WEnd

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

    Func _correct()
    Iniwrite ("pw.ini","Password","Password",$read1)
    MsgBox (0,"","Succesfull")

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

    EndFunc

    [/autoit]

    //Edit: fehler berichtigt

    i2c: danke nicht gesehn

  • hey,...
    das Problem ist "war" ^^ das die INputbox vor der Schleife eingelesen wurde...
    Somit hat isch der eingegebene Wert nicht aktualisert,
    ein Einlesen beim Klick auf den Button ist sinnvoll (denke ich)
    anbei ist der korrigierte Code


    [autoit]

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

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

    #Region ### START Koda GUI section ### Form=

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

    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    Case $Button1
    $read1 = GuiCtrlRead($Input1)
    $read2 = GuiCtrlRead($Input2)
    If $read1 = $read2 then _correct()
    If $read1 <> $read2 then MsgBox(0,"","Passwörter stimmen nicht überein")

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

    Case $Button2
    $readini = IniRead( "pw.ini", "Password", "Password", "")
    MsgBox(0,"Informationen","Ihr aktuelles Password lautet:" &$readini)

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

    EndSwitch
    WEnd

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

    Func _correct()
    Iniwrite ("pw.ini","Password","Password",String($read1))
    MsgBox (0,"","Succesfull")

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

    EndFunc

    [/autoit]

    ""

  • Ich habe nun den Code von xslip benutz jedoch steht in meiner ini weiterhin nur:

    Code
    [Password]
    Password=


    aber trotzdem allen danke..


    lg n3v

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    If GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
    _correct()
    Else
    MsgBox(0, "", "Passwörter stimmen nicht überein")
    EndIf
    Case $Button2
    $readini = IniRead("pw.ini", "Password", "Password", "")
    MsgBox(0, "Informationen", "Ihr aktuelles Password lautet:" & $readini)
    EndSwitch
    WEnd

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

    Func _correct()
    IniWrite("pw.ini", "Password", "Password", GUICtrlRead($Input1))
    MsgBox(0, "", "Succesfull")
    EndFunc ;==>_correct

    [/autoit]
  • Soo ich bins nochmal,

    also irgendwie funkt gar nix mit der Ini bei mir vielleicht ist was am befehl falsch?
    der name muss stimmen hab auch schon den ganzen salat unbenannt und nix hineingeschrieben aber es funkt einfach nicht...


    lg n3v


    //edit: Komicherweiße kann er die ini auslesen... ö.Ö also der informations button funkt, aber ich kann nichts in der ini einsehen =o

    Einmal editiert, zuletzt von n3v (15. Juni 2010 um 19:02)

  • Bringt auch nix..gleiches Problem es wird nichts in die Ini geschrieben ich aknn sie zwar mit iniread auslesen aber auch nur mit dieser au3, ne andre findet so wie ich auch nichts...

    lg n3v

  • [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 438, 351, 192, 124)
    GUISetFont(12, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("Password", 136, 80, 241, 28)
    $Input2 = GUICtrlCreateInput("Password", 136, 144, 241, 28)
    $Label1 = GUICtrlCreateLabel("Password :", 40, 80, 91, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Bestätigen:", 32, 143, 96, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Legen Sie ihr Sysrem Password fest", 128, 16, 258, 24)
    $Button1 = GUICtrlCreateButton("Übernehmen", 128, 232, 105, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Information", 264, 232, 113, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    If GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
    _correct()
    Else
    MsgBox(0, "", "Passwörter stimmen nicht überein")
    EndIf
    Case $Button2
    $readini = IniRead(@ScriptDir & "\frederik.ini", "Password", "Password", "")
    MsgBox(0, "Informationen", "Ihr aktuelles Password lautet:" & $readini)
    EndSwitch
    WEnd

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

    Func _correct()
    IniWrite(@ScriptDir & "\frederik.ini", "Password", "Password", GUICtrlRead($Input1))
    MsgBox(0, "", "Succesfull")
    EndFunc ;==>_correct

    [/autoit]

    hab die ini vorhind mal unbenannt um zusehn ob ich was falsch eingegeben ahbe aber funkt leider auch nicht..


    lg n3v

  • Nein geht leider immer noch nicht, ...

    also in meiner ini steht 0 allerdings kann das script die ini trotzdem auslesen ein anderes script jedoch kann es nicht..

    Fast schon lustig xD...

    lg n3v