_ispressed gibt falschen Buchstaben aus??

  • Hi!
    Ich arbeite momentan an einem Script, das mir helfen soll, bei meinem Moddingprogramm schnell Befehle auszuführen. Wenn ich Shift drücke, und dann den Namen einer Funktion eingebe, soll diese gestartet werden.. hab soweit alles hinbekommen, aber an der stelle haperts:

    Spoiler anzeigen
    [autoit]


    #include <WinAPI.au3>
    #Include <Misc.au3>
    $dll = DllOpen("user32.dll")
    $result = ""
    $done = 0

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

    While 1
    $1 = _IsPressed( "61", $dll )
    $2 = _IsPressed( "62", $dll )
    $3 = _IsPressed( "63", $dll )
    $4 = _IsPressed( "64", $dll )
    $5 = _IsPressed( "65", $dll )
    $6 = _IsPressed( "66", $dll )
    $7 = _IsPressed( "67", $dll )
    $8 = _IsPressed( "68", $dll )
    $9 = _IsPressed( "69", $dll )
    $10 = _IsPressed( "6a", $dll )
    $11 = _IsPressed( "6b", $dll )
    $12 = _IsPressed( "6c", $dll )
    $13 = _IsPressed( "6d", $dll )
    $14 = _IsPressed( "6e", $dll )
    $15 = _IsPressed( "6f", $dll )
    $16 = _IsPressed( "70", $dll )
    $17 = _IsPressed( "71", $dll )
    $18 = _IsPressed( "72", $dll )
    $19 = _IsPressed( "73", $dll )
    $20 = _IsPressed( "74", $dll )
    $21 = _IsPressed( "75", $dll )
    $22 = _IsPressed( "76", $dll )
    $23 = _IsPressed( "77", $dll )
    $24 = _IsPressed( "78", $dll )
    $25 = _IsPressed( "79", $dll )
    $26 = _IsPressed( "7a", $dll )
    $27 = _IsPressed( "30", $dll )
    $28 = _IsPressed( "31", $dll )
    $29 = _IsPressed( "32", $dll )
    $30 = _IsPressed( "33", $dll )
    $31 = _IsPressed( "34", $dll )
    $32 = _IsPressed( "35", $dll )
    $33 = _IsPressed( "36", $dll )
    $34 = _IsPressed( "37", $dll )
    $35 = _IsPressed( "38", $dll )
    $36 = _IsPressed( "39", $dll )
    $37 = _IsPressed( "41", $dll )
    $38 = _IsPressed( "42", $dll )
    $39 = _IsPressed( "43", $dll )
    $40 = _IsPressed( "44", $dll )
    $41 = _IsPressed( "45", $dll )
    $42 = _IsPressed( "46", $dll )
    $43 = _IsPressed( "47", $dll )
    $44 = _IsPressed( "48", $dll )
    $45 = _IsPressed( "49", $dll )
    $46 = _IsPressed( "4a", $dll )
    $47 = _IsPressed( "4b", $dll )
    $48 = _IsPressed( "4c", $dll )
    $49 = _IsPressed( "4d", $dll )
    $50 = _IsPressed( "4e", $dll )
    $51 = _IsPressed( "4f", $dll )
    $52 = _IsPressed( "50", $dll )
    $53 = _IsPressed( "51", $dll )
    $54 = _IsPressed( "52", $dll )
    $55 = _IsPressed( "53", $dll )
    $56 = _IsPressed( "54", $dll )
    $57 = _IsPressed( "55", $dll )
    $58 = _IsPressed( "56", $dll )
    $59 = _IsPressed( "57", $dll )
    $60 = _IsPressed( "58", $dll )
    $61 = _IsPressed( "59", $dll )
    $62 = _IsPressed( "5a", $dll )

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

    $active1 = WinActive ( "The Elder Scrolls 4 - Construction Set" )
    If $active1 = 1 Then
    $done = 1
    Select
    Case $1 = 1
    $Result &= "a"
    Case $2 = 1
    $Result &= "b"
    Case $3 = 1
    $Result &= "c"
    Case $4 = 1
    $Result &= "d"
    Case $5 = 1
    $Result &= "e"
    Case $6 = 1
    $Result &= "f"
    Case $7 = 1
    $Result &= "g"
    Case $8 = 1
    $Result &= "h"
    Case $9 = 1
    $Result &= "i"
    Case $10 = 1
    $Result &= "j"
    Case $11 = 1
    $Result &= "k"
    Case $12 = 1
    $Result &= "l"
    Case $13 = 1
    $Result &= "m"
    Case $14 = 1
    $Result &= "n"
    Case $15 = 1
    $Result &= "o"
    Case $16 = 1
    $Result &= "p"
    Case $17 = 1
    $Result &= "q"
    Case $18 = 1
    $Result &= "r"
    Case $19 = 1
    $Result &= "s"
    Case $20 = 1
    $Result &= "t"
    Case $21 = 1
    $Result &= "u"
    Case $22 = 1
    $Result &= "v"
    Case $23 = 1
    $Result &= "w"
    Case $24 = 1
    $Result &= "x"
    Case $25 = 1
    $Result &= "y"
    Case $26 = 1
    $Result &= "z"
    Case $27 = 1
    $Result &= "0"
    Case $28 = 1
    $Result &= "1"
    Case $29 = 1
    $Result &= "2"
    Case $30 = 1
    $Result &= "3"
    Case $31 = 1
    $Result &= "4"
    Case $32 = 1
    $Result &= "5"
    Case $33 = 1
    $Result &= "6"
    Case $34 = 1
    $Result &= "7"
    Case $35 = 1
    $Result &= "8"
    Case $36 = 1
    $Result &= "9"
    Case $37 = 1
    $Result &= "0"
    Case $38 = 1
    $Result &= "A"
    Case $39 = 1
    $Result &= "B"
    Case $40 = 1
    $Result &= "C"
    Case $41 = 1
    $Result &= "D"
    Case $42 = 1
    $Result &= "E"
    Case $43 = 1
    $Result &= "F"
    Case $44 = 1
    $Result &= "G"
    Case $45 = 1
    $Result &= "H"
    Case $46 = 1
    $Result &= "I"
    Case $47 = 1
    $Result &= "J"
    Case $48 = 1
    $Result &= "K"
    Case $49 = 1
    $Result &= "L"
    Case $50 = 1
    $Result &= "M"
    Case $51 = 1
    $Result &= "N"
    Case $52 = 1
    $Result &= "O"
    Case $53 = 1
    $Result &= "P"
    Case $54 = 1
    $Result &= "Q"
    Case $55 = 1
    $Result &= "R"
    Case $56 = 1
    $Result &= "S"
    Case $57 = 1
    $Result &= "T"
    Case $58 = 1
    $Result &= "U"
    Case $59 = 1
    $Result &= "V"
    Case $60 = 1
    $Result &= "W"
    Case $61 = 1
    $Result &= "X"
    Case $62 = 1
    $Result &= "Z"
    EndSelect
    sleep ( 100 )
    EndIf
    if $done = 50000 Then
    DllClose($dll)
    Exit
    Else
    $done = $done + 1
    EndIf

    [/autoit]

    Das script is aus Probezwecken noch nicht ganz logisch.
    Ich hatte es mal so, das ausgegeben werden soll was ich eingeben habe, und dann kam die Messagebox, in der eigentlich "Admin Controlpannel" stehen sollte irgentwie: "000000000000CCCCCCCCCCCCDDDDDDDDDDDDDDIIIIIIIIIIIIIIIIIIAAAAAAAAAAAAAAASSSSSSSSSSSSSSSSSSS.." also totaler schwachsinn.. warum die Zeichen so oft wiederholt werden könnte daran liegen, das ich die taste ja ne Zeit gedrückt halte, aber warum sind die Buchstaben falsch????

  • ähm sorry aber ich sehe es irgendwie net :|

    Außerdem könnte mir jemand verraten, wie man bei _winapi_createfile den Pfad des Files angeben kann?

  • du kannst das viel einfache rmachen, dann ist die auswertung auch nicht so a gschlaa

    [autoit]

    ;===============================================================================
    ; Function: _GetKeyPressed($iOption)
    ; Description: Returns the keyboard key that was pressed.
    ; Parameter(s): $iOption = 1: Returns ASCII value for the key pressed.
    ; $iOption = 0: Returns Hex value for the key pressed.
    ; $iOption = 2: Returns the character for the key pressed.
    ; Requirement(s): Must include <misc.au3>
    ; Return Value(s): On Success - Returns a character corresponding the keyboard button pressed.
    ; On Failure - -1(No key was pressed) and Set
    ; @ERROR to: 1 - No key was pressed.
    ; Author(s): Chris95219 and The Author of _IsPressed()
    ; Note(s):
    ;
    ;===============================================================================

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

    Func _GetKeyPressed($iOption = 2)
    For $i = 0 to 255
    if (_IsPressed(Hex($i, 2))) Then
    Select
    Case $iOption = 0
    Return Hex($i)
    Case $iOption = 1
    Return $i
    Case $iOption = 2
    Return Chr($i)
    EndSelect
    EndIf
    Next
    SetError(1)
    Return -1
    EndFunc

    [/autoit]

    und einfach mit switch und endswitch! << schneller

  • *Kopfreib* scheiß Kopfschmerzen.. naja das kommt davon wenn man sich 10 Minuten Lang den Kopf gegen die Wand hämmert....

    Darauf hät ich auch selbst kommen können dankesehr!

    man braucht nichteinmal switch... weiß noch einer eine antwort auf meine Frage mit Filecreate?

    Einmal editiert, zuletzt von Xaser (30. August 2008 um 21:49)