from Quartz.CoreGraphics import *
CGEventPost(kCGHIDEventTap,CGEventCreateKeyboardEvent(None18,1)) # send key 1
CGEventPost(kCGHIDEventTap,CGEventCreateKeyboardEvent(None,19,1)) # send key 2
CGEventPost(kCGHIDEventTap,CGEventCreateKeyboardEvent(None,20,1)) # send key 3
CGEventPost(kCGHIDEventTap,CGEventCreateKeyboardEvent(None,21,1)) #send key 4
## list of CGKeyCodes
“a” = 0 | “b” = 11 | “c” = 8 | “d” = 2 | “e” = 14 | “f” = 3 | “g” = 5 | “h” = 4 | “i” = 34 | “j” = 38 |
“k” = 40 | “l” = 37 | “m” = 46 | “n” = 45 | “o” = 31 | “p” = 35 | “q” = 12 | “r” = 15 | “s” = 1 | “t” = 17 |
“u” = 32 | “v” = 9 | “w” = 13 | “x” = 7 | “y” = 16 | “z” = 6 | “Carriage Return” = 36 | |||
“0” = 29 | “1” = 18 | “2” = 19 | “3” = 20 | “4” = 21 | “5” = 23 | “6” = 22 | “7” = 26 | “8” = 28 | “9” = 25 |
“.” = 47 | “,” = 43 | “=” = 24 | “-” = 27 | “]” = 30 | “[” = 33 | “‘” = 39 | “” = 41 | “\” = 42 | “/” = 44 |