123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2022/10/30 19:17:40
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc :
- '''
- # https://pyautogui.readthedocs.io/en/latest/keyboard.html
- # https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes?redirectedfrom=MSDN
- # ['\t', '\n', '\r', ' ', '!', '"', '#', '$', '%', '&', "'", '(',
- # ')', '*', '+', ',', '-', '.', '/',':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`','{', '|', '}', '~',
- # 'accept', 'add', 'altleft', 'altright', '',
- # 'convert', 'delete',
- # escape', # , 'fn'
- # 'modechange'
- # 'nonconvert','win''yen',
- # 'command', 'option'
- KEYMAP = {
- 0x09: 'tab',
- 0x0D: 'enter',
- 0x41: 'a',
- 0x42: 'b',
- 0x43: 'c',
- 0x44: 'd',
- 0x45: 'e',
- 0x46: 'f',
- 0x47: 'g',
- 0x48: 'h',
- 0x49: 'i',
- 0x4A: 'j',
- 0x4B: 'k',
- 0x4C: 'l',
- 0x4D: 'm',
- 0x4E: 'n',
- 0x4F: 'o',
- 0x50: 'p',
- 0x51: 'q',
- 0x52: 'r',
- 0x53: 's',
- 0x54: 't',
- 0x55: 'u',
- 0x56: 'v',
- 0x57: 'w',
- 0x58: 'x',
- 0x59: 'y',
- 0x5A: 'z',
- 0x30: '0',
- 0x31: '1',
- 0x32: '2',
- 0x33: '3',
- 0x34: '4',
- 0x35: '5',
- 0x36: '6',
- 0x37: '7',
- 0x38: '8',
- 0x39: '9',
- 0x0C: 'clear',
- 0x08: 'backspace',
- 0x10: 'shift',
- # 0x11: 'ctrl',
- 0x12: 'alt',
- 0x13: 'pause',
- 0x14: 'capslock',
- 0x15: 'hangul',
- 0x17: 'junja',
- 0x18: 'final',
- 0x19: 'kanji',
- 0x1B: 'esc',
- 0x20: 'space',
- 0x21: 'pageup',
- 0x22: 'pagedown',
- 0x23: 'end',
- 0x24: 'home',
- 0x25: 'left',
- 0x26: 'up',
- 0x27: 'right',
- 0x28: 'down',
- 0x29: 'select',
- 0x2A: 'print',
- 0x2B: 'execute',
- 0x2C: 'printscreen',
- 0x2D: 'insert',
- 0x2E: 'del',
- 0x2F: 'help',
- 0x5B: 'winleft',
- 0x5C: 'winright',
- 0x5D: 'apps',
- 0x5F: 'sleep',
- 0x60: 'num0',
- 0x61: 'num1',
- 0x62: 'num2',
- 0x63: 'num3',
- 0x64: 'num4',
- 0x65: 'num5',
- 0x66: 'num6',
- 0x67: 'num7',
- 0x68: 'num8',
- 0x69: 'num9',
- 0x6A: 'multiply',
- 0x6B: 'add',
- 0x6C: 'separator',
- 0x6D: 'subtract',
- 0x6E: 'decimal',
- 0x6F: 'divide',
- 0x70: 'f1',
- 0x71: 'f2',
- 0x72: 'f3',
- 0x73: 'f4',
- 0x74: 'f5',
- 0x75: 'f6',
- 0x76: 'f7',
- 0x77: 'f8',
- # 0x78: 'f9', # used for Pausing execution
- 0x79: 'f10',
- 0x7A: 'f11',
- 0x7B: 'f12',
- 0x7C: 'f13',
- 0x7D: 'f14',
- 0x7E: 'f15',
- 0x7F: 'f16',
- 0x80: 'f17',
- 0x81: 'f18',
- 0x82: 'f19',
- 0x83: 'f20',
- 0x84: 'f21',
- 0x85: 'f22',
- 0x86: 'f23',
- 0x87: 'f24',
- 0x90: 'numlock',
- 0x91: 'scrolllock',
- 0xA0: 'shiftleft',
- 0xA1: 'shiftright',
- 0xA2: 'ctrlleft',
- 0xA3: 'ctrlright',
- 0xA4: 'optionleft',
- 0xA5: 'optionright',
- 0xA6: 'browserback',
- 0xA7: 'browserforward',
- 0xA8: 'browserrefresh',
- 0xA9: 'browserstop',
- 0xAA: 'browsersearch',
- 0xAB: 'browserfavorites',
- 0xAC: 'browserhome',
- 0xAD: 'volumemute',
- 0xAE: 'volumedown',
- 0xAF: 'volumeup',
- 0xB0: 'nexttrack',
- 0xB1: 'prevtrack',
- 0xB2: 'stop',
- 0xB3: 'playpause',
- 0xB4: 'launchmail',
- 0xB5: 'launchmediaselect',
- 0xB6: 'launchapp1',
- 0xB7: 'launchapp2'
- }
|