Jump to content

Always irritated by the _IsPressed key codes? [UPDATED! again]


ludocus
 Share

Recommended Posts

UPDATED!! again.. :)

I always hate to search up a key code for _IsPressed

It's just annoying

So I made MiscConstants udf.. :(

here it is:

;$VK = Virtual Key Code :)
;the following script will help in _IsPressed($VK_L_MOUSE)
;Completely created by ludocus, got the codes from: http://delphi.about.com/od/objectpascalide/l/blvkc.htm
;Enjoy!
;updated to v2.0
Global Const $VK_L_MOUSE = '01'
Global Const $VK_R_MOUSE = '02'
Global Const $VK_CTRL_BREAK = '03'
Global Const $VK_M_MOUSE = '04'
Global Const $VK_BACK = '08'
Global Const $VK_TAB = '09'
Global Const $VK_CLEAR = '0C'
Global Const $VK_ENTER = '0D'
Global Const $VK_SHIFT = 10
Global Const $VK_CTRL = 11
Global Const $VK_ALT = 12
Global Const $VK_PAUSE = 13
Global Const $VK_CAPS = 14
Global Const $VK_ESC = '1B'
Global Const $VK_SPACE = 20
Global Const $VK_PAGE_UP = 21
Global Const $VK_PADE_DOWN = 22
Global Const $VK_END = 23
Global Const $VK_HOME = 24
Global Const $VK_LEFT = 25
Global Const $VK_UP = 26
Global Const $VK_RIGHT = 27
Global Const $VK_DOWN = 28
Global Const $VK_SELECT = 29
Global Const $VK_PRINT = '2A'
Global Const $VK_EXECUTE = '2B'
Global Const $VK_PRINT_SCR = '2C'
Global Const $VK_INS = '2D'
Global Const $VK_DEL = '2E'
Global Const $VK_HELP = '2F'
Global Const $VK_0 = 30
Global Const $VK_1 = 31
Global Const $VK_2 = 32
Global Const $VK_3 = 33
Global Const $VK_4 = 34
Global Const $VK_5 = 35
Global Const $VK_6 = 36
Global Const $VK_7 = 37
Global Const $VK_8 = 38
Global Const $VK_9 = 39
Global Const $VK_A = 41
Global Const $VK_B = 42
Global Const $VK_C = 43
Global Const $VK_D = 44
Global Const $VK_E = 45
Global Const $VK_F = 46
Global Const $VK_G = 47
Global Const $VK_H = 48
Global Const $VK_I = 49
Global Const $VK_J = '4A'
Global Const $VK_K = '4B'
Global Const $VK_L = '4C'
Global Const $VK_M = '4D'
Global Const $VK_N = '4E'
Global Const $VK_O = '4F'
Global Const $VK_P = 50
Global Const $VK_Q = 51
Global Const $VK_R = 52
Global Const $VK_S = 53
Global Const $VK_T = 54
Global Const $VK_U = 55
Global Const $VK_V = 56
Global Const $VK_W = 57
Global Const $VK_X = 58
Global Const $VK_Y = 59
Global Const $VK_Z = '5A'
Global Const $VK_L_WIN = '5B'
Global Const $VK_R_WIN = '5C'
Global Const $VK_APP = '5D'
Global Const $VK_NUMPAD0 = 60 
Global Const $VK_NUMPAD1 = 61
Global Const $VK_NUMPAD2 = 62
Global Const $VK_NUMPAD3 = 63
Global Const $VK_NUMPAD4 = 64
Global Const $VK_NUMPAD5 = 65
Global Const $VK_NUMPAD6 = 66
Global Const $VK_NUMPAD7 = 67
Global Const $VK_NUMPAD8 = 68
Global Const $VK_NUMPAD9 = 69
Global Const $VK_MULTIPLY = '6A'
Global Const $VK_ADD = '6B'
Global Const $VK_SEPERATOR = '6C'
Global Const $VK_SUBSTRACT = '6D'
Global Const $VK_DECIMAL = '6E'
Global Const $VK_DIVIDE = '6F'
Global Const $VK_F1 = 70
Global Const $VK_F2 = 71
Global Const $VK_F3 = 72
Global Const $VK_F4 = 73
Global Const $VK_F5 = 74
Global Const $VK_F6 = 75
Global Const $VK_F7 = 76
Global Const $VK_F8 = 77
Global Const $VK_F9 = 78
Global Const $VK_F10 = 79
Global Const $VK_F11 = '7A'
Global Const $VK_F12 = '7B'
Global Const $VK_F13 = '7C'
Global Const $VK_F14 = '7D'
Global Const $VK_F15 = '7E'
Global Const $VK_F16 = '7F'
Global Const $VK_F17 = '80H'
Global Const $VK_F18 = '81H'
Global Const $VK_F19 = '82H'
Global Const $VK_F20 = '83H'
Global Const $VK_F21 = '84H'
Global Const $VK_F22 = '85H'
Global Const $VK_F23 = '86H'
Global Const $VK_F24 = '87H'
Global Const $VK_NUMLOCK = 90
Global Const $VK_SCROLL_LOCK = 91
Global Const $VK_L_SHIFT = 'A0'
Global Const $VK_R_SHIFT = 'A1'
Global Const $VK_L_CTRL = 'A2'
Global Const $VK_R_CTRL = 'A3'
Global Const $VK_L_MENU = 'A4'
Global Const $VK_R_MENU = 'A5'
Global Const $VK_PLAY = 'FA'
Global Const $VK_ZOOM = 'FB'
Global Const $VK_OFF = 'DF'
Global Const $VK_COMMA = 'BC'
Global Const $VK_POINT = 'BE'
Global Const $VK_PERIOD = 'BE'
Global Const $VK_PLUS = 'BB'
Global Const $VK_MINUS = 'BD'
;other:
Global Const $VK_COLON = 'BA' ;==> :;
Global Const $VK_SLASH = 'BF' ;==> /?
Global Const $VK_TILDE = 'C0' ;==> `~
Global Const $VK_OPEN_BRACKET = 'DB' ;==> [{
Global Const $VK_CLOSE_BRACKET = 'DD' ;==> ]}
Global Const $VK_BACK_SLASH = 'DC' ;==> \|
Global Const $VK_QUOTATION = 'DE' ;==> '"

Enjoy

comments are welcome :D

Download here

Edited by ludocus
Link to comment
Share on other sites

Since it's all hex, you can remove the quotation marks from the ones with the hex letters, and just do 0x** for the codes. Autoit recognizes hexadecimal strings (Or however one would phrase that)

So instead of:

$SOME_CONSTANT = 01

$SOME_OTHER_CONSTANT = '1D'

You can use

$SOME_CONSTANT = 0x01

$SOME_OTHER_CONSTANT = 0x1D

Link to comment
Share on other sites

very helpful :)

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

@KentonBomb

yeh maybe. But I don't see the usefullness of that :(

Actually, if you don't, then these codes are incorrect because a number in decimal isn't equal to the same number in hex. For example, hexadecimal 20 (space bar) = 50 in decimal. You wrote the space bar as being decimal 20, which is really 14 in hexadecimal (caps lock). So ... either convert each hexadecimal number into decimal (the hard way) or just add a '0x' in front of each one (the easy way) :)

Edited by Hallman
Link to comment
Share on other sites

dude look:

;$VK = Virtual Key Code :)
;the following script will help in _IsPressed($VK_L_MOUSE)
;Completely created by ludocus, got the codes from: http://delphi.about.com/od/objectpascalide/l/blvkc.htm
;Enjoy!
;updated to v2.00
#include <Misc.au3>
Global Const $VK_L_MOUSE = 0x01
Global Const $VK_R_MOUSE = 0x02
Global Const $VK_CTRL_BREAK = 0x03
Global Const $VK_M_MOUSE = 0x04
Global Const $VK_BACK = 0x08
Global Const $VK_TAB = 0x09
Global Const $VK_CLEAR = 0x0C
Global Const $VK_ENTER = 0x0D
Global Const $VK_SHIFT = 0x10
Global Const $VK_CTRL = 0x11
Global Const $VK_ALT = 0x12
Global Const $VK_PAUSE = 0x13
Global Const $VK_CAPS = 0x14
Global Const $VK_ESC = 0x1B
Global Const $VK_SPACE = 0x20
Global Const $VK_PAGE_UP = 0x21
Global Const $VK_PADE_DOWN = 0x22
Global Const $VK_END = 0x23
Global Const $VK_HOME = 0x24
Global Const $VK_LEFT = 0x25
Global Const $VK_UP = 0x26
Global Const $VK_RIGHT = 0x27
Global Const $VK_DOWN = 0x28
Global Const $VK_SELECT = 0x29
Global Const $VK_PRINT = 0x2A
Global Const $VK_EXECUTE = 0x2B
Global Const $VK_PRINT_SCR = 0x2C
Global Const $VK_INS = 0x2D
Global Const $VK_DEL = 0x2E
Global Const $VK_HELP = 0x2F
Global Const $VK_0 = 0x30
Global Const $VK_1 = 0x31
Global Const $VK_2 = 0x32
Global Const $VK_3 = 0x33
Global Const $VK_4 = 0x34
Global Const $VK_5 = 0x35
Global Const $VK_6 = 0x36
Global Const $VK_7 = 0x37
Global Const $VK_8 = 0x38
Global Const $VK_9 = 0x39
Global Const $VK_A = 0x41
Global Const $VK_B = 0x42
Global Const $VK_C = 0x43
Global Const $VK_D = 0x44
Global Const $VK_E = 0x45
Global Const $VK_F = 0x46
Global Const $VK_G = 0x47
Global Const $VK_H = 0x48
Global Const $VK_I = 0x49
Global Const $VK_J = 0x4A
Global Const $VK_K = 0x4B
Global Const $VK_L = 0x4C
Global Const $VK_M = 0x4D
Global Const $VK_N = 0x4E
Global Const $VK_O = 0x4F
Global Const $VK_P = 0x50
Global Const $VK_Q = 0x51
Global Const $VK_R = 0x52
Global Const $VK_S = 0x53
Global Const $VK_T = 0x54
Global Const $VK_U = 0x55
Global Const $VK_V = 0x56
Global Const $VK_W = 0x57
Global Const $VK_X = 0x58
Global Const $VK_Y = 0x59
Global Const $VK_Z = 0x5A
Global Const $VK_L_WIN = 0x5B
Global Const $VK_R_WIN = 0x5C
Global Const $VK_APP = 0x5D
Global Const $VK_NUMPAD0 = 0x60 
Global Const $VK_NUMPAD1 = 0x61
Global Const $VK_NUMPAD2 = 0x62
Global Const $VK_NUMPAD3 = 0x63
Global Const $VK_NUMPAD4 = 0x64
Global Const $VK_NUMPAD5 = 0x65
Global Const $VK_NUMPAD6 = 0x66
Global Const $VK_NUMPAD7 = 0x67
Global Const $VK_NUMPAD8 = 0x68
Global Const $VK_NUMPAD9 = 0x69
Global Const $VK_MULTIPLY = 0x6A
Global Const $VK_ADD = 0x6B
Global Const $VK_SEPERATOR = 0x6C
Global Const $VK_SUBSTRACT = 0x6D
Global Const $VK_DECIMAL = 0x6E
Global Const $VK_DIVIDE = 0x6F
Global Const $VK_F1 = 0x70
Global Const $VK_F2 = 0x71
Global Const $VK_F3 = 0x72
Global Const $VK_F4 = 0x73
Global Const $VK_F5 = 0x74
Global Const $VK_F6 = 0x75
Global Const $VK_F7 = 0x76
Global Const $VK_F8 = 0x77
Global Const $VK_F9 = 0x78
Global Const $VK_F10 = 0x79
Global Const $VK_F11 = 0x7A
Global Const $VK_F12 = 0x7B
Global Const $VK_F13 = 0x7C
Global Const $VK_F14 = 0x7D
Global Const $VK_F15 = 0x7E
Global Const $VK_F16 = 0x7F
Global Const $VK_F17 = '0x80H'
Global Const $VK_F18 = '0x81H'
Global Const $VK_F19 = '0x82H'
Global Const $VK_F20 = '0x83H'
Global Const $VK_F21 = '0x84H'
Global Const $VK_F22 = '0x85H'
Global Const $VK_F23 = '0x86H'
Global Const $VK_F24 = '0x87H'
Global Const $VK_NUMLOCK = 0x90
Global Const $VK_SCROLL_LOCK = 0x91
Global Const $VK_L_SHIFT = 0xA0
Global Const $VK_R_SHIFT = 0xA1
Global Const $VK_L_CTRL = 0xA2
Global Const $VK_R_CTRL = 0xA3
Global Const $VK_L_MENU = 0xA4
Global Const $VK_R_MENU = 0xA5
Global Const $VK_PLAY = 0xFA
Global Const $VK_ZOOM = 0xFB
Global Const $VK_OFF = 0xDF
Global Const $VK_COMMA = 0xBC
Global Const $VK_POINT = 0xBE
Global Const $VK_PERIOD = 0xBE
Global Const $VK_PLUS = 0xBB
Global Const $VK_MINUS = 0xBD
;other:
Global Const $VK_OTHER_1 = 0xBA ;==> :;
Global Const $VK_OTHER_2 = 0xBF ;==> /?
Global Const $VK_OTHER_3 = 0xC0 ;==> `~
Global Const $VK_OTHER_4 = 0xDB ;==> [{
Global Const $VK_OTHER_5 = 0xDD ;==> ]}
Global Const $VK_OTHER_6 = 0xDC ;==> \|
Global Const $VK_OTHER_7 = 0xDE ;==> '"
$user32 = DllOpen('user32.dll')
Tooltip('Keystroke: ')
while 1
    if _IsPressed($VK_OTHER_1) then tooltip('keystroke: :;')
    
WEnd

THAT DOESN'T WORK!!!

thnx for telling me... NOT! :)

when I do this:

Global Const $VK_OTHER_1 = 'BA' ;==> :;

THAT DOES WORK!!

Edited by ludocus
Link to comment
Share on other sites

To give the $VK_OTHERs a name:

: = colon

; = semicolon

/ = slash, devide

? = question mark

` = single quote, apostrophe

~ = tilde

[ = opening square bracket

{ = opening curly brace

] = closing square bracket

} = closing curly brace

\ = backslash

| = it's a line, but the name.... :)

' = single quotation mark (not sure)

" = quotation mark

Edited by Kip
Link to comment
Share on other sites

  • 7 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...