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

Arrow Keys

Numeric Keypad

Function Keys

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:

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


History

VersionStatusNotes
10.1.1UpdatedCarried 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.