keymap.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2022/10/30 19:17:40
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc :
  8. '''
  9. # https://pyautogui.readthedocs.io/en/latest/keyboard.html
  10. # https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes?redirectedfrom=MSDN
  11. # ['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(',
  12. # ')', '*', '+', ',', '-', '.', '/',':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`','{', '|', '}', '~',
  13. # 'accept', 'add', 'altleft', 'altright', '',
  14. # 'convert', 'delete',
  15. # escape', # , 'fn'
  16. # 'modechange'
  17. # 'nonconvert','win''yen',
  18. # 'command', 'option'
  19. KEYMAP = {
  20. 0x09: 'tab',
  21. 0x0D: 'enter',
  22. 0x41: 'a',
  23. 0x42: 'b',
  24. 0x43: 'c',
  25. 0x44: 'd',
  26. 0x45: 'e',
  27. 0x46: 'f',
  28. 0x47: 'g',
  29. 0x48: 'h',
  30. 0x49: 'i',
  31. 0x4A: 'j',
  32. 0x4B: 'k',
  33. 0x4C: 'l',
  34. 0x4D: 'm',
  35. 0x4E: 'n',
  36. 0x4F: 'o',
  37. 0x50: 'p',
  38. 0x51: 'q',
  39. 0x52: 'r',
  40. 0x53: 's',
  41. 0x54: 't',
  42. 0x55: 'u',
  43. 0x56: 'v',
  44. 0x57: 'w',
  45. 0x58: 'x',
  46. 0x59: 'y',
  47. 0x5A: 'z',
  48. 0x30: '0',
  49. 0x31: '1',
  50. 0x32: '2',
  51. 0x33: '3',
  52. 0x34: '4',
  53. 0x35: '5',
  54. 0x36: '6',
  55. 0x37: '7',
  56. 0x38: '8',
  57. 0x39: '9',
  58. 0x0C: 'clear',
  59. 0x08: 'backspace',
  60. 0x10: 'shift',
  61. # 0x11: 'ctrl',
  62. 0x12: 'alt',
  63. 0x13: 'pause',
  64. 0x14: 'capslock',
  65. 0x15: 'hangul',
  66. 0x17: 'junja',
  67. 0x18: 'final',
  68. 0x19: 'kanji',
  69. 0x1B: 'esc',
  70. 0x20: 'space',
  71. 0x21: 'pageup',
  72. 0x22: 'pagedown',
  73. 0x23: 'end',
  74. 0x24: 'home',
  75. 0x25: 'left',
  76. 0x26: 'up',
  77. 0x27: 'right',
  78. 0x28: 'down',
  79. 0x29: 'select',
  80. 0x2A: 'print',
  81. 0x2B: 'execute',
  82. 0x2C: 'printscreen',
  83. 0x2D: 'insert',
  84. 0x2E: 'del',
  85. 0x2F: 'help',
  86. 0x5B: 'winleft',
  87. 0x5C: 'winright',
  88. 0x5D: 'apps',
  89. 0x5F: 'sleep',
  90. 0x60: 'num0',
  91. 0x61: 'num1',
  92. 0x62: 'num2',
  93. 0x63: 'num3',
  94. 0x64: 'num4',
  95. 0x65: 'num5',
  96. 0x66: 'num6',
  97. 0x67: 'num7',
  98. 0x68: 'num8',
  99. 0x69: 'num9',
  100. 0x6A: 'multiply',
  101. 0x6B: 'add',
  102. 0x6C: 'separator',
  103. 0x6D: 'subtract',
  104. 0x6E: 'decimal',
  105. 0x6F: 'divide',
  106. 0x70: 'f1',
  107. 0x71: 'f2',
  108. 0x72: 'f3',
  109. 0x73: 'f4',
  110. 0x74: 'f5',
  111. 0x75: 'f6',
  112. 0x76: 'f7',
  113. 0x77: 'f8',
  114. # 0x78: 'f9', # used for Pausing execution
  115. 0x79: 'f10',
  116. 0x7A: 'f11',
  117. 0x7B: 'f12',
  118. 0x7C: 'f13',
  119. 0x7D: 'f14',
  120. 0x7E: 'f15',
  121. 0x7F: 'f16',
  122. 0x80: 'f17',
  123. 0x81: 'f18',
  124. 0x82: 'f19',
  125. 0x83: 'f20',
  126. 0x84: 'f21',
  127. 0x85: 'f22',
  128. 0x86: 'f23',
  129. 0x87: 'f24',
  130. 0x90: 'numlock',
  131. 0x91: 'scrolllock',
  132. 0xA0: 'shiftleft',
  133. 0xA1: 'shiftright',
  134. 0xA2: 'ctrlleft',
  135. 0xA3: 'ctrlright',
  136. 0xA4: 'optionleft',
  137. 0xA5: 'optionright',
  138. 0xA6: 'browserback',
  139. 0xA7: 'browserforward',
  140. 0xA8: 'browserrefresh',
  141. 0xA9: 'browserstop',
  142. 0xAA: 'browsersearch',
  143. 0xAB: 'browserfavorites',
  144. 0xAC: 'browserhome',
  145. 0xAD: 'volumemute',
  146. 0xAE: 'volumedown',
  147. 0xAF: 'volumeup',
  148. 0xB0: 'nexttrack',
  149. 0xB1: 'prevtrack',
  150. 0xB2: 'stop',
  151. 0xB3: 'playpause',
  152. 0xB4: 'launchmail',
  153. 0xB5: 'launchmediaselect',
  154. 0xB6: 'launchapp1',
  155. 0xB7: 'launchapp2'
  156. }