def __init__(self, clickSpeed = 0.5): """Init of our VMouse sets up an ulong for extra information provided by the operating system, an Input Interface object and a virtual click table.""" self.input_I = Input_I() self.extra = c_ulong(0) self.clickSpeed = clickSpeed #Constant for moving mouse wheel. One 'click' forward #is equal to 120 self.wheelDelta = 120 #In general, we will want to click a button and #release it in order to simulate a single click self.clickTable = { 'left': [0x02, 0x04], 'right': [0x08, 0x10], 'middle': [0x20, 0x40], 'wheel': [0x800], 'hold_left': [0x02], 'release_left': [0x04], 'hold_right': [0x08], 'release_right': [0x10], 'hold_middle': [0x20], 'release_middle': [0x40] } VHIDLog.debug('Virtual mouse instantiated.')
def __init__(self, typeSpeed = 0.05): """Init of our VKeyboard sets up an ulong for extra information provided by the operating system, an Input Interface object and the virtual key code table.""" self.initState = self._getKeyboardState() #Zero all the keys of the keyboard zeroState = KeyBdState() for button in zeroState.array: button = 0 self._setKeyboardState(zeroState) self.extra = c_ulong(0) self.click = Input_I() self.typeSpeed = typeSpeed self.specials = """-=+[];'#\,./""" #Modified 3 is a pound symbol, but seems to be misinterpreted by python. #Damn them brits. self.modSpecials = { '!': 1, '"': 2, '$': 4, '%': 5, '^': 6, '&': 7, '*': 8, '(': 9, ')': 0, '_': '-', '{': '[', '}': '}', ':': ';', '@': "'", '~': '#', '|': '\\', '<': ',', '>': '.', '?': '/' } self.vKeyTable = { 'VK_BACKSPACE': 0x08, 'VK_TAB': 0x09, 'VK_ENTER': 0x0D, 'VK_SHIFT': 0x10, 'VK_CTRL': 0x11, 'VK_ALT': 0x12, 'VK_PAUSE': 0x13, 'VK_CAPSLOCK': 0x14, 'VK_ESCAPE': 0x1B, ' ': 0x20, 'VK_SPACEBAR': 0x20, 'VK_PAGEUP': 0x21, 'VK_PAGEDOWN': 0x22, 'VK_END': 0x23, 'VK_HOME': 0x24, 'VK_LEFT': 0x25, 'VK_UP': 0x26, 'VK_RIGHT': 0x27, 'VK_DOWN': 0x28, 'VK_PRINTSCR': 0x2C, 'VK_INSERT': 0x2D, 'VK_DELETE': 0x2E, 'VK_HELP': 0x2F, 0: 0x30, 1: 0x31, 2: 0x32, 3: 0x33, 4: 0x34, 5: 0x35, 6: 0x36, 7: 0x37, 8: 0x38, 9: 0x39, 'a': 0x41, 'b': 0x42, 'c': 0x43, 'd': 0x44, 'e': 0x45, 'f': 0x46, 'g': 0x47, 'h': 0x48, 'i': 0x49, 'j': 0x4a, 'k': 0x4b, 'l': 0x4c, 'm': 0x4d, 'n': 0x4e, 'o': 0x4f, 'p': 0x50, 'q': 0x51, 'r': 0x52, 's': 0x53, 't': 0x54, 'u': 0x55, 'v': 0x56, 'w': 0x57, 'x': 0x58, 'y': 0x59, 'z': 0x5a, 'VK_LWINKEY': 0x5B, 'VK_RWINKEY': 0x5C, 'VK_APPKEY': 0x5D, 'VK_SLEEP': 0x5F, 'VK_NUM0': 0x60, 'VK_NUM1': 0x61, 'VK_NUM2': 0x62, 'VK_NUM3': 0x63, 'VK_NUM4': 0x64, 'VK_NUM5': 0x65, 'VK_NUM6': 0x66, 'VK_NUM7': 0x67, 'VK_NUM8': 0x68, 'VK_NUM9': 0x69, 'VK_MULTIPLY': 0x6A, 'VK_ADD': 0x6B, #What the hell is the Separator key? 'VK_SEP': 0x6C, 'VK_SUB': 0x6D, 'VK_DECIMAL': 0x6E, 'VK_DIVIDE': 0x6E, 'VK_F1': 0x70, 'VK_F2': 0x71, 'VK_F3': 0x72, 'VK_F4': 0x73, 'VK_F5': 0x74, 'VK_F6': 0x75, 'VK_F7': 0x76, 'VK_F8': 0x77, 'VK_F9': 0x78, 'VK_F10': 0x79, 'VK_F11': 0x7a, 'VK_F12': 0x7b, 'VK_F13': 0x7c, 'VK_F14': 0x7d, 'VK_F15': 0x7e, 'VK_F16': 0x7f, 'VK_F17': 0x80, 'VK_F18': 0x81, 'VK_F19': 0x82, 'VK_F20': 0x83, 'VK_F21': 0x84, 'VK_F22': 0x85, 'VK_F23': 0x86, 'VK_F24': 0x87, 'VK_NUMLOCK': 0x90, 'VK_SCROLL': 0x91, 'VK_LSHIFT': 0xA0, 'VK_RSHIFT': 0xA1, 'VK_LCTRL': 0xA2, 'VK_RCTRL': 0xA3, 'VK_LMENU': 0xA4, 'VK_RMENU': 0xA5, #Browser Buttons 'VK_B_Back': 0xA6, 'VK_B_Forward': 0xA7, 'VK_B_Refresh': 0xA8, 'VK_B_Stop': 0xA9, 'VK_B_Search': 0xAA, 'VK_B_Favorites': 0xAB, 'VK_VOL_MUTE': 0xAD, 'VK_VOL_DOWN': 0xAE, 'VK_VOL_UP': 0xAF, 'VK_NEXT_TRACK': 0xB0, 'VK_PREV_TRACK': 0xB1, 'VK_STOP_TRACK': 0xB2, 'VK_PLAY_PAUSE': 0xB3, 'VK_MAIL': 0xB4, 'VK_MEDIA': 0xB5, 'VK_APP1': 0xB6, 'VK_APP2': 0xB7, #Misc key, varies by keyboard ';': 0xBA, 'VK_SEMI_COLON': 0xBA, '+': 0xBB, 'VK_OEM_PLUS': 0xBB, ',': 0xBC, 'VK_OEM_COMMA': 0xBC, '-': 0xBD, 'VK_OEM_MINUS': 0xBD, '.': 0xBE, 'VK_OEM_PERIOD': 0xBE, #Misc key, varies by keyboard '/': 0xBF, 'VK_SLASH': 0xBF, #Misc key, varies by keyboard "'": 0xC0, 'VK_APOSTROPHE': 0xC0, #Misc key, varies by keyboard '[': 0xDB, 'VK_OPEN_SQUARE_BRACKET': 0xDB, #Misc key, varies by keyboard '\\': 0xDC, 'VK_BACKSLASH': 0xDC, #Misc key, varies by keyboard ']': 0xDD, 'VK_CLOSE_SQUARE_BRACKET': 0xDD, #Misc key, varies by keyboard '#': 0xDE, 'VK_HASH': 0xDE, } #Might be helpful #http://www.kbdedit.com/manual/low_level_vk_list.html VHIDLog.debug('Virtual keyboard instantiated.')