GET KEY STATE This command will return the state of the specified virtual key.
Syntax
    Return Integer=GET KEY STATE(Virtual Key Value)
Parameters
    Virtual Key Value
Integer The hardware key value
Returns
The value of zero or one if the key is not pressed, the two states being the toggle state for that key. A negative value is returned if the key is pressed.
Description
The example below contains the complete list of virtual key names and the hexidecimal value you should use to detect activity on that key.
Example Code
    rem Virtual Key Detect

    rem VK_LBUTTON        0x01

    rem VK_RBUTTON        0x02

    rem VK_CANCEL         0x03

    rem VK_MBUTTON        0x04

    rem VK_BACK           0x08

    rem VK_TAB            0x09

    rem VK_CLEAR          0x0C

    rem VK_RETURN         0x0D

    rem VK_SHIFT          0x10

    rem VK_CONTROL        0x11

    rem VK_MENU           0x12

    rem VK_PAUSE          0x13

    rem VK_CAPITAL        0x14

    rem VK_KANA           0x15

    rem VK_HANGUL         0x15

    rem VK_JUNJA          0x17

    rem VK_FINAL          0x18

    rem VK_HANJA          0x19

    rem VK_KANJI          0x19

    rem VK_ESCAPE         0x1B

    rem VK_CONVERT        0x1c

    rem VK_NOCONVERT      0x1d

    rem VK_SPACE          0x20

    rem VK_PRIOR          0x21

    rem VK_NEXT           0x22

    rem VK_END            0x23

    rem VK_HOME           0x24

    rem VK_LEFT           0x25

    rem VK_UP             0x26

    rem VK_RIGHT          0x27

    rem VK_DOWN           0x28

    rem VK_SELECT         0x29

    rem VK_PRINT          0x2A

    rem VK_EXECUTE        0x2B

    rem VK_SNAPSHOT       0x2C

    rem VK_INSERT         0x2D

    rem VK_DELETE         0x2E

    rem VK_HELP           0x2F

    rem VK_0 thru VK_9 are the same as ASCII "0" thru "9" (0x30 - 0x39)

    rem VK_A thru VK_Z are the same as ASCII "A" thru "Z" (0x41 - 0x5A)

    rem VK_LWIN           0x5B

    rem VK_RWIN           0x5C

    rem VK_APPS           0x5D

    rem VK_SLEEP          0x5F

    rem VK_NUMPAD0        0x60

    rem VK_NUMPAD1        0x61

    rem VK_NUMPAD2        0x62

    rem VK_NUMPAD3        0x63

    rem VK_NUMPAD4        0x64

    rem VK_NUMPAD5        0x65

    rem VK_NUMPAD6        0x66

    rem VK_NUMPAD7        0x67

    rem VK_NUMPAD8        0x68

    rem VK_NUMPAD9        0x69

    rem VK_MULTIPLY       0x6A

    rem VK_ADD            0x6B

    rem VK_SEPARATOR      0x6C

    rem VK_SUBTRACT       0x6D

    rem VK_DECIMAL        0x6E

    rem VK_DIVIDE         0x6F

    rem VK_F1             0x70

    rem VK_F2             0x71

    rem VK_F3             0x72

    rem VK_F4             0x73

    rem VK_F5             0x74

    rem VK_F6             0x75

    rem VK_F7             0x76

    rem VK_F8             0x77

    rem VK_F9             0x78

    rem VK_F10            0x79

    rem VK_F11            0x7A

    rem VK_F12            0x7B

    rem VK_F13            0x7C

    rem VK_F14            0x7D

    rem VK_F15            0x7E

    rem VK_F16            0x7F

    rem VK_F17            0x80

    rem VK_F18            0x81

    rem VK_F19            0x82

    rem VK_F20            0x83

    rem VK_F21            0x84

    rem VK_F22            0x85

    rem VK_F23            0x86

    rem VK_F24            0x87

    rem VK_NUMLOCK        0x90

    rem VK_SCROLL         0x91

    rem VK_LSHIFT         0xA0

    rem VK_RSHIFT         0xA1

    rem VK_LCONTROL       0xA2

    rem VK_RCONTROL       0xA3

    rem VK_LMENU          0xA4

    rem VK_RMENU          0xA5

    rem VK_PROCESSKEY     0xE5

    rem VK_ATTN           0xF6

    rem VK_CRSEL          0xF7

    rem VK_EXSEL          0xF8

    rem VK_EREOF          0xF9

    rem VK_PLAY           0xFA

    rem VK_ZOOM           0xFB

    rem VK_NONAME         0xFC

    rem VK_PA1            0xFD

    rem VK_OEM_CLEAR      0xFE

    rem VK_SEMICOLON      0xBA

    rem VK_EQUAL          0xBB

    rem VK_COMMA          0xBC

    rem VK_HYPHEN         0xBD

    rem VK_PERIOD         0xBE

    rem VK_SLASH          0xBF

    rem VK_BACKQUOTE      0xC0

    rem VK_BROWSER_BACK                  0xA6

    rem VK_BROWSER_FORWARD               0xA7

    rem VK_BROWSER_REFRESH               0xA8

    rem VK_BROWSER_STOP                  0xA9

    rem VK_BROWSER_SEARCH                0xAA

    rem VK_BROWSER_FAVORITES             0xAB

    rem VK_BROWSER_HOME                  0xAC

    rem VK_VOLUME_MUTE                   0xAD

    rem VK_VOLUME_DOWN                   0xAE

    rem VK_VOLUME_UP                     0xAF

    rem VK_MEDIA_NEXT_TRACK              0xB0

    rem VK_MEDIA_PREV_TRACK              0xB1

    rem VK_MEDIA_STOP                    0xB2

    rem VK_MEDIA_PLAY_PAUSE              0xB3

    rem VK_LAUNCH_MAIL                   0xB4

    rem VK_LAUNCH_MEDIA_SELECT           0xB5

    rem VK_LAUNCH_APP1                   0xB6

    rem VK_LAUNCH_APP2                   0xB7

    do

     cls

     print "VK_F1=";get key state(0x70)

    loop

    end
See also
INPUT Commands Menu Index