Passwort eingabe

  • Hallo,
    ich bins mal wieder XD und ich hab ein problem mit meinem script,
    ich möchte gern per Passworteingabe eine checkbox freigeben weiss aber nicht wie

    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Funtionen Freigabe", 32, 64, 105, 49, $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
    Case $Button1
    Function()
    EndSwitch
    WEnd

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

    Func Function()
    $pw = InputBox( "Password", "Bitte Eingeben :D", "","*", 230 , 120)
    If $pw = "1234" Then
    msgbox(0,"","Right PW - Funktion will be unlocked")

    Else
    msgbox(0,"","wrong pw")
    Exit
    EndIf
    EndFunc

    [/autoit]

    Danke schonmal voraus ;(

    • Offizieller Beitrag

    So geht's:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Funtionen Freigabe", 32, 64, 105, 49, $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
    Case $Button1
    Function()
    EndSwitch
    WEnd

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

    Func Function()
    $pw = InputBox("Password", "Bitte Eingeben :D", "", "*", 230, 120)
    If $pw = "1234" Then
    MsgBox(0, "", "Right PW - Funktion will be unlocked")
    GUICtrlSetState($Checkbox1, $GUI_ENABLE) ; <- so kannst Du die Checkbox wieder aktivieren
    Else
    MsgBox(0, "", "wrong pw")
    Exit
    EndIf
    EndFunc ;==>Function

    [/autoit]
  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Funtionen Freigabe", 32, 64, 105, 49, $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
    Case $Button1
    Function()
    EndSwitch
    WEnd

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

    Func Function()
    $pw = InputBox( "Password", "Bitte Eingeben :D", "","*", 230 , 120)
    If $pw = "1234" Then
    msgbox(0,"","Right PW - Funktion will be unlocked")
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)
    GUICtrlSetState(0, $GUI_ENABLE)

    Else
    msgbox(0,"","wrong pw")
    Exit
    EndIf
    EndFunc

    [/autoit]

    oder

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 192, 124)
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $Button1 = GUICtrlCreateButton("Funtionen Freigabe", 32, 64, 105, 49, $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
    Case $Button1
    Function()
    EndSwitch
    WEnd

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

    Func Function()
    $pw = InputBox( "Password", "Bitte Eingeben :D", "","*", 230 , 120)
    If $pw = "1234" Then
    msgbox(0,"","Right PW - Funktion will be unlocked")
    $Checkbox1 = GUICtrlCreateCheckbox("test", 48, 8, 137, 33)


    Else
    msgbox(0,"","wrong pw")
    Exit
    EndIf
    EndFunc

    [/autoit]

    LOL. Hab nach ner Lösung gesucht und das Fenster nicht aktualisiert. Als ich es dann hatte, dachte ich wäre der erste..
    war aber um 7 Minuten zu spät X(

  • Hallo
    Ich hätt auch noch eine Frage dazu.
    Wie könnt man es machen das zwischen Gross/Klein Schreibung des Passworts unterschieden wird ?

    [autoit]

    If $pw = "XxXx" Then

    [/autoit]

    Also das es genauso eingegeben werden muss wie es hinterlegt ist.

  • Mit

    [autoit]

    If $pw == "XxXx" Then

    [/autoit]

    Boahh. 2-3 Sekunden zu langsam.
    MoD: ich möchte gerne genau die Sekunden haben, wann i2c und ich gepostet haben.