KinderSicherrung

  • Hallo
    ich wil mir ne kindersicherrung machen krige da aber ein problem

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <String.au3>
    #include <WindowsConstants.au3>
    $versuch = 3
    $tasten = "|01|02|03|04|05|06|07|08|09|0c|0d|10|11|12|13|14|1b|20|21|22|23|24|25|26|27|28|29|2a|2b|2c|2d|2e|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|45|46|47|48|49|4a|4b|4c|4d|4e|4f|50|51|52|53|54|55|56|57|58|59|5a|5b|5c|60|61|62|63|64|65|66|67|68|69|6a|6b|6c|6d|6e|6f|70|71|72|73|74|75|76|77||78|79|7a|7b|7c|7d|7e|7f|80h|81h|82h|83h|84h|85h|86h|87h|90|91|a0|a1|a2|a3|a4|a5|ba|bb|bc|bd|be|bf|c0|db|dc|dd|"
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Kindersicherrung", 352, 126, 480, 263,$WS_POPUP)
    $Label1 = GUICtrlCreateLabel("Bitte gib das Passwort ein.", 8, 8, 332, 17)
    $Input1 = GUICtrlCreateInput("", 8, 40, 337, 21)
    $Label2 = GUICtrlCreateLabel("Sie haben noch " & $versuch & " Versuche !", 8, 72, 340, 17)
    $Button1 = GUICtrlCreateButton("OK", 136, 96, 75, 25, $WS_GROUP)
    #EndRegion ### END Koda GUI section ###

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

    #cs
    While 1
    $string = _StringBetween ($tasten,"|","")
    If _IsPressed ($string) Then
    ExitLoop
    GUISetState(@SW_SHOW)
    EndIf
    WEnd
    #ce
    GUISetState(@SW_SHOW)
    While 1
    _MouseTrap (480,263,352+480,126+263)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $in = GUICtrlRead ($Input1)
    If $in <> "test" Then
    $versuch = $versuch - 1
    GUICtrlSetData ($Label2,"Sie haben noch " & $versuch & " Versuche !")
    EndIf
    If $in = "test" Then Exit
    If $versuch = 0 Then Shutdown (1)
    EndSwitch
    WEnd

    [/autoit]

    die erste while funktioniert nicht aber es soll funktionieren was kann ich machen das es geht ?

  • Die Zeile

    [autoit]

    $string = _StringBetween ($tasten,"|","")

    [/autoit]

    sucht den ersten Inhalt zwischen 2 |. Am besten ist du nutzt StringSplit, und überprüfst ob eine Taste im Array gedrückt wurde (For-Schleife in der While-Schleife...)

  • alles falsch :D
    es regaiert nicht wie ich es mache

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    $tasten = "01|02|03|04|05|06|07|08|09|0c|0d|10|11|12|13|14|1b|20|21|22|23|24|25|26|27|28|29|2a|2b|2c|2d|2e|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|45|46|47|48|49|4a|4b|4c|4d|4e|4f|50|51|52|53|54|55|56|57|58|59|5a|5b|5c|60|61|62|63|64|65|66|67|68|69|6a|6b|6c|6d|6e|6f|70|71|72|73|74|75|76|77||78|79|7a|7b|7c|7d|7e|7f|80h|81h|82h|83h|84h|85h|86h|87h|90|91|a0|a1|a2|a3|a4|a5|ba|bb|bc|bd|be|bf|c0|db|dc|dd"
    While 1
    $string = StringSplit ($taste,"|",0)
    ToolTip ("Taste:" & $string,0,0)
    If _IsPressed ($string) Then MsgBox (0,"",$string)
    WEnd

    [/autoit]
  • Du mahcst auch in der While-Schleife den Splitter, probier es so:

    [autoit]

    #include <Misc.au3>
    $tasten = "01|02|03|04|05|06|07|08|09|0c|0d|10|11|12|13|14|1b|20|21|22|23|24|25|26|27|28|29|2a|2b|2c|2d|2e|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|45|46|47|48|49|4a|4b|4c|4d|4e|4f|50|51|52|53|54|55|56|57|58|59|5a|5b|5c|60|61|62|63|64|65|66|67|68|69|6a|6b|6c|6d|6e|6f|70|71|72|73|74|75|76|77||78|79|7a|7b|7c|7d|7e|7f|80h|81h|82h|83h|84h|85h|86h|87h|90|91|a0|a1|a2|a3|a4|a5|ba|bb|bc|bd|be|bf|c0|db|dc|dd"
    $tasten_array = StringSplit ($taste,"|",0)
    $dll = DllOpen("user32.dll")

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

    While 1
    For $i = 1 To $taste_array[0]
    If _IsPressed ($tasten_array[$i], $dll) Then MsgBox (0,"",$tasten_array[$i])
    Next
    WEnd
    DllClose($dll)

    [/autoit]

    Das Problem ist nur die Performance...

  • habe das jetz so

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <String.au3>
    #include <WindowsConstants.au3>
    $versuch = 3
    $tasten = "01|02|03|04|05|06|07|08|09|0c|0d|10|11|12|13|14|1b|20|21|22|23|24|25|26|27|28|29|2a|2b|2c|2d|2e|30|31|32|33|34|35|36|37|38|39|41|42|43|44|45|45|46|47|48|49|4a|4b|4c|4d|4e|4f|50|51|52|53|54|55|56|57|58|59|5a|5b|5c|60|61|62|63|64|65|66|67|68|69|6a|6b|6c|6d|6e|6f|70|71|72|73|74|75|76|77||78|79|7a|7b|7c|7d|7e|7f|80h|81h|82h|83h|84h|85h|86h|87h|90|91|a0|a1|a2|a3|a4|a5|ba|bb|bc|bd|be|bf|c0|db|dc|dd"

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Kindersicherrung", 352, 126, 480, 263,$WS_POPUP)
    $Label1 = GUICtrlCreateLabel("Bitte gib das Passwort ein.", 8, 8, 332, 17)
    $Input1 = GUICtrlCreateInput("", 8, 40, 337, 21)
    $Label2 = GUICtrlCreateLabel("Sie haben noch " & $versuch & " Versuche !", 8, 72, 340, 17)
    $Button1 = GUICtrlCreateButton("OK", 136, 96, 75, 25, $WS_GROUP)
    #EndRegion ### END Koda GUI section ###

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

    $dll = DllOpen("user32.dll")

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

    While 1
    $string = StringSplit ($tasten,"|",0)
    For $a = 1 To ubound($string)-1
    ToolTip ($string[$a],0,0)
    If _IsPressed ($string,$dll) Then
    DllClose($dll)
    _passwort ()
    EndIf
    Next
    WEnd

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

    Func _passwort ()
    GUISetState(@SW_SHOW)
    While 1
    _MouseTrap (480,263,352+480,126+263)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $in = GUICtrlRead ($Input1)
    If $in <> "test" Then
    $versuch = $versuch - 1
    GUICtrlSetData ($Label2,"Sie haben noch " & $versuch & " Versuche !")
    EndIf
    If $in = "test" Then Exit
    If $versuch = 0 Then Shutdown (1)
    EndSwitch
    WEnd
    EndFunc

    [/autoit]

    und das geht nicht :(

  • Du hast das hier ja immer noch nicht geändert:

    [autoit]

    While 1
    $string = StringSplit ($tasten,"|",0)
    For $a = 1 To ubound($string)-1
    ToolTip ($string[$a],0,0)
    If _IsPressed ($string,$dll) Then
    DllClose($dll)
    _passwort ()
    EndIf
    Next
    WEnd

    [/autoit]

    Mache es so:

    [autoit]


    $string = StringSplit ($tasten,"|",0)

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

    While 1
    For $a = 1 To ubound($string)-1
    ToolTip ($string[$a],0,0)
    If _IsPressed ($string,$dll) Then
    DllClose($dll)
    _passwort ()
    EndIf
    Next
    WEnd

    [/autoit]

    Und wenn es wieder nicht klappt, beschreibe bitte genauer, welche Fehler kommen, was genau nicht funktioniert.

  • Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <EditConstants.au3>
    #include <WindowsConstants.au3>

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

    Global $Form1, $Label1, $Input1, $Label2, $Button1, $versuch = 3

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

    While 1
    For $i = 0 To 255
    If _IsPressed(Hex($i, 2)) Then
    _passwort()
    EndIf
    Next
    Sleep(10)
    WEnd

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

    Func _passwort()
    $Form1 = GUICreate("Kindersicherrung", 352, 126, 480, 263, $WS_POPUP)
    $Label1 = GUICtrlCreateLabel("Bitte gib das Passwort ein.", 8, 8, 332, 17)
    $Input1 = GUICtrlCreateInput("", 8, 40, 337, 21, $ES_PASSWORD)
    $Label2 = GUICtrlCreateLabel("Sie haben noch " & $versuch & " Versuche !", 8, 72, 340, 17)
    $Button1 = GUICtrlCreateButton("OK", 136, 96, 75, 25, $WS_GROUP)

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

    GUISetState(@SW_SHOW)

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

    While 1
    _MouseTrap(480, 263, 352 + 480, 126 + 263)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    _enter()
    EndSwitch

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

    If _IsPressed("0D") Then
    While _IsPressed("0D")
    Sleep(10)
    WEnd
    _enter()
    EndIf
    WEnd
    EndFunc ;==>_passwort

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

    Func _enter()
    $in = GUICtrlRead($Input1)
    If $in <> "test" Then
    $versuch -= 1
    GUICtrlSetData($Label2, "Sie haben noch " & $versuch & " Versuche !")
    EndIf
    If $in = "test" Then Exit
    If $versuch = 0 Then
    Shutdown(1)
    Exit
    EndIf
    EndFunc ;==>_enter

    [/autoit]