(* About Mac Key codes: unfortunately, mac key codes are keyboard specific: that is, there is no universal VK_A, but every keyboard has its code for VK_A Key codes depend on physical key position on the keyboard: considering a QWERTY keyboard and an AZERTY one, keycode(Q) of first one = keycode(A) of the second one, and so on. For "printable" keys we can rely on kEventParamKeyMacCharCodes and kEventParamKeyUnicodes event parameters to obtain an ascii/unicode value that we can translate to the appropriate VK_ code For non printable keys (Function, ins, arrow and so on...) we use the raw keycodes, since it looks like they are constant across all keyboards So, here are constants for non-printable keys (MK means "Mac Key"). These constants were extracted using KeyCodes program by Peter Maurer (http://www.petermaurer.de/nasi.php?section=keycodes) Some keys were taken from the ancient "Macintosh Toolbox Essentials", page 87 http://developer.apple.com/documentation/mac/pdf/MacintoshToolboxEssentials.pdf *) const MK_ENTER = $24; MK_SPACE = $31; MK_ESC = $35; MK_F1 = $7A; MK_F2 = $78; MK_F3 = $63; MK_F4 = $76; MK_F5 = $60; MK_F6 = $61; MK_F7 = $62; MK_F8 = $64; MK_F9 = $65; MK_F10 = $6D; MK_F11 = $67; MK_F12 = $6F; MK_F13 = $69; MK_PRNSCR = MK_F13; //Print screen = F13 MK_F14 = $6B; MK_SCRLOCK = MK_F14; //Scroll Lock = F14 MK_F15 = $71; MK_PAUSE = MK_F15; //Pause = F15 MK_POWER = $7F7F; MK_TAB = $30; MK_INS = $72; MK_HELP = MK_INS; //old macs call this key "help" MK_DEL = $75; MK_HOME = $73; MK_END = $77; MK_PAGUP = $74; MK_PAGDN = $79; MK_UP = $7E; MK_DOWN = $7D; MK_LEFT = $7B; MK_RIGHT = $7C; MK_NUMLOCK = $47; MK_NUMPAD0 = $52; MK_NUMPAD1 = $53; MK_NUMPAD2 = $54; MK_NUMPAD3 = $55; MK_NUMPAD4 = $56; MK_NUMPAD5 = $57; MK_NUMPAD6 = $58; MK_NUMPAD7 = $59; MK_NUMPAD8 = $5b; MK_NUMPAD9 = $5c; MK_PADEQUALS = $51; //only present in old mac keyboards? MK_PADDIV = $4B; MK_PADMULT = $43; MK_PADSUB = $4E; MK_PADADD = $45; MK_PADDEC = $41; MK_PADENTER = $4C; //enter on numeric keypad MK_BACKSPACE = $33; MK_CAPSLOCK = $39; //Modifiers codes - you'll never get these directly MK_SHIFTKEY = $38; MK_CTRL = $3B; MK_ALT = $3A; MK_OPTION = MK_ALT; MK_COMMAND = $37; MK_APPLE = MK_COMMAND; MK_TILDE = 50; // `/~ key MK_MINUS = 27; // -/_ key MK_EQUAL = 24; // =/+ key MK_BACKSLASH = 42; // \ | key MK_LEFTBRACKET = 33; // [ { key MK_RIGHTBRACKET = 30; // ] } key MK_SEMICOLON = 41; // ; : key MK_QUOTE = 39; // ' " key MK_COMMA = 43; // , < key MK_PERIOD = 47; // . > key MK_SLASH = 44; // / ? key