info(“keycode”)
info(“keycode”)

The info(“keycode”) function returns a special numeric code that represents the last key that was pressed.

Description

This function returns a special numeric code that represents the last key that was pressed. This code is unique for every key in the keyboard. For example, the info(“keycode”) function will return different value for the 1 key on the numeric keyboard (if your keyboard has a numeric keyboard) and the 1 key above the Q key on the main keyboard. The following tables list the keycode values for each key (in hexadecimal). You can also use the Hotkey Workshop to find out the keycode value for any key simply by pressing on it.

#### Main Keyboard

- A - 00
- B - 0B
- C - 08
- D - 02
- E - 0E
- F - 03
- G - 05
- H - 04
- I - 22
- J - 26
- K - 28
- L - 25
- M - 2E
- N - 2D
- O - 1F
- P - 23
- Q - 0C
- R - 0F
- S - 01
- T - 11
- U - 20
- V - 09
- W - 0D
- X - 07
- Y - 10
- Z - 06
- [ - 21
- ] - 1E
- ; - 29
- ’ - 27
- , - 2B
- . - 2F
- / - 2C
- SPACE - 31
- ` - 32
- 1 - 12
- 2 - 13
- 3 - 14
- 4 - 15
- 5 - 17
- 6 - 16
- 7 - 1A
- 8 - 1C
- 9 - 19
- 0 - 1D
- `-` - 1B
- = 18
- DELETE - 33
- \ - 2A
- ENTER - 24

#### Arrow Keys

- UP ARROW - 7E
- DOWN ARROW - 7D
- LEFT ARROW - 7B
- RIGHT ARROW - 7C

#### Numeric Keypad

- 0 - 52
- 1 - 53
- 2 - 54
- 3 - 55
- 4 - 56
- 5 - 57
- 6 - 58
- 7 - 59
- 8 - 5B
- 9 - 5C
- ENTER - 4C
- CLEAR - 47
- = - 51
- / - 4B
- `*` - 43
- `+` - 4E
- `-` - 45

#### Function Keys

- ESC - 35
- F1 - 7A
- F2 - 7B
- F3 - 63
- F4 - 76
- F5 - 60
- F6 - 61
- F7 - 62
- F8 - 64
- F9 - 65
- F10 - 6D
- F11 - 67
- F12 - 6F
- F13 - 69
- F14 - 6B
- F15 - 71
- HELP - 72
- HOME - 73
- PAGE UP - 74
- PAGE DN - 79
- DEL - 75
- END - 77

#### Modifier Keys

The modifier keys (Shift, Control, Option and Command) only work in combination with the regular keys listed above. The key codes listed above are followed by two additional digits that indicate whether any modifier keys are also pressed. For example, the full code for the “K” key is normally

    2800

But if the shift key is pressed, the code becomes

    2802

Here are the codes for the four modifier keys:

- SHIFT - 02
- CONTROL - 10
- OPTION - 08
- COMMAND - 01

These codes can be combined (via hex addition) if more than one modifier key is pressed. For example, if SHIFT-OPTION-K is pressed, the code will be:

    280A

Note: The value `A` in hexidecimal is `10` in decimal, so `8+2` is 10, which is represented as `0A` in hexadecimal.

#### Examples

The example below checks to see if the last key pressed was the `0` on the numeric keypad:

    if info("keycode")[1,2] = "52"

This example checks to see if the last key pressed was the F1 key:

    if info("keycode")[1,2] = "7A"

This example checks to see if the last key pressed was OPTION-D.

    if info("keycode") = "0208"

See Also

- definehotkeys -- defines one or more Hotkeys.
- Hotkey Workshop -- tool that assists in composing a definehotkeys statement.
- info("keyboard") -- returns the last key that was pressed.

History

Version | Status | Notes
10.1.1 | Updated | Carried over from Panorama 6.0, but the returned keycodes are completely different. Also, keycodes are now returned as a text value instead of a number, with the text value representing the numeric value in hexadecimal format.