Sign in to follow this  
Followers 0
Aceguy

returning the key pressed....ie. "The Enter Key"

3 posts in this topic

#1 ·  Posted (edited)

here is what i have

#include <misc.au3>
WinActivate("Untitled - Notepad")
sleep(2000)

                For $ct = 8 To 165
                    $hex = Hex($ct, 2)
                    ConsoleWrite($ct & "  Hex " & $hex & @LF)
                    $keydown=0
                    While _IsPressed($hex)
                        Sleep(10)
                        $keydown += 1
                        If $keydown > 100 Then
                            MsgBox(262144 + 64, "KEYSTUCK", $hex, 0)
                        EndIf
                    WEnd
                Next

i know the long winded way for creating an array with all the key strokes in it, and returing the match.... NOT the Hex but the actual KEY as in easy read terms, "The Space Bar" , "The Left Control Key", etc.

But is there a quicker way.....

Edited by Aceguy

Share this post


Link to post
Share on other sites



Use the _IsPressed function

You can use my MiscConstants UDF to make it easier,

EX:

#Include <Misc.au3> ;needed to use the _IsPressed function
#Include "MiscConstants.au3" ;udf if you want to use the pre-defined constants

_IsPressed("0D")
;enter without MiscConstants UDF, Key gotten from help file entry

_IsPressed($VK_ENTER)
;enter with MiscConstants UDF, Keys are pretty obvious but can be looked up in the AU3 file if necicary

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Share this post


Link to post
Share on other sites

this is a long version

#include <misc.au3>
#include<array.au3>

WinActivate("Untitled - Notepad")
dim $key[99]
$Key[1]='09 TAB key'
$Key[2]='0C CLEAR key'
$Key[3]='0D ENTER key'
$Key[4]='10 SHIFT key'
$Key[5]='11 CTRL key'
$Key[6]='12 ALT key'
$Key[7]='13 PAUSE key'
$Key[8]='14 CAPS LOCK key'
$Key[9]='1B ESC key'
$Key[10]='20 SPACEBAR'
$Key[11]='21 PAGE UP key'
$Key[12]='22 PAGE DOWN key'
$Key[13]='23 END key'
$Key[14]='24 HOME key'
$Key[15]='25 LEFT ARROW key'
$Key[16]='26 UP ARROW key'
$Key[17]='27 RIGHT ARROW key'
$Key[18]='28 DOWN ARROW key'
$Key[19]='29 SELECT key'
$Key[20]='2A PRINT key'
$Key[21]='2B EXECUTE key'
$Key[22]='2C PRINT SCREEN key'
$Key[23]='2D INS key'
$Key[24]='2E DEL key'
$Key[25]='30 0 key'
$Key[26]='31 1 key'
$Key[27]='32 2 key'
$Key[28]='33 3 key'
$Key[29]='34 4 key'
$Key[30]='35 5 key'
$Key[31]='36 6 key'
$Key[32]='37 7 key'
$Key[33]='38 8 key'
$Key[34]='39 9 key'
$Key[35]='41 A key'
$Key[36]='42 B key'
$Key[37]='43 C key'
$Key[38]='44 D key'
$Key[39]='45 E key'
$Key[40]='46 F key'
$Key[41]='47 G key'
$Key[42]='48 H key'
$Key[43]='49 I key'
$Key[44]='4A J key'
$Key[45]='4B K key'
$Key[46]='4C L key'
$Key[47]='4D M key'
$Key[48]='4E N key'
$Key[49]='4F O key'
$Key[50]='50 P key'
$Key[51]='51 Q key'
$Key[52]='52 R key'
$Key[53]='53 S key'
$Key[54]='54 T key'
$Key[55]='55 U key'
$Key[56]='56 V key'
$Key[57]='57 W key'
$Key[58]='58 X key'
$Key[59]='59 Y key'
$Key[60]='5A Z key'
$Key[61]='5B Left Windows key'
$Key[62]='5C Right Windows key'
$Key[63]='60 Numeric keypad 0 key'
$Key[64]='61 Numeric keypad 1 key'
$Key[65]='62 Numeric keypad 2 key'
$Key[66]='63 Numeric keypad 3 key'
$Key[67]='64 Numeric keypad 4 key'
$Key[68]='65 Numeric keypad 5 key'
$Key[69]='66 Numeric keypad 6 key'
$Key[70]='67 Numeric keypad 7 key'
$Key[71]='68 Numeric keypad 8 key'
$Key[72]='69 Numeric keypad 9 key'
$Key[73]='6A Multiply key'
$Key[74]='6B Add key'
$Key[75]='6C Separator key'
$Key[76]='6D Subtract key'
$Key[77]='6E Decimal key'
$Key[78]='6F Divide key'
$Key[79]='70 F1 key'
$Key[80]='71 F2 key'
$Key[81]='72 F3 key'
$Key[82]='73 F4 key'
$Key[83]='74 F5 key'
$Key[84]='75 F6 key'
$Key[85]='76 F7 key'
$Key[86]='77 F8 key'
$Key[87]='78 F9 key'
$Key[88]='79 F10 key'
$Key[89]='7A F11 key'
$Key[90]='7B F12 key'
$Key[91]='90 NUM LOCK key'
$Key[92]='91 SCROLL LOCK key'
$Key[93]='A0 Left SHIFT key'
$Key[94]='A1 Right SHIFT key'
$Key[95]='A2 Left CONTROL key'
$Key[96]='A3 Right CONTROL key'
$Key[97]='A4 Left MENU key'
$Key[98]='A5 Right MENU key'
sleep(2000)

while 1
$keydown=0
For $ct2 = 8 To 165
                    $hex = Hex($ct2, 2)
                    
                    
                    While _IsPressed($hex)
                        Sleep(10)
                        $keydown += 1
                        If $keydown > 100 Then
                            $search=_ArraySearch($key,$hex,0,0,0,1)
                            if not @error Then
                            $sss=StringSplit($key[$search]," ")
                            $rec=""
                            for $1=2 to $sss[0]
                            $rec&=$sss[$1]&" "
                            Next
                            MsgBox(262144 + 64, "KEYSTUCK","The "&$rec&" Is Locked!!!", 0)
                        EndIf
                        EndIf
                    WEnd
                Next
                WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0