def klick(key): context = lib.interception_create_context() stroke = ffi.new('InterceptionMouseStroke *') stroke.state = key lib.interception_send(context, 1, stroke, 1) lib.interception_destroy_context(context)
def mausklick(): context = lib.interception_create_context() stroke = ffi.new('InterceptionMouseStroke *') stroke.state = SCANCODE.INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN lib.interception_send(context, 11, stroke, 1) stroke.state = SCANCODE.INTERCEPTION_MOUSE_LEFT_BUTTON_UP lib.interception_send(context, 11, stroke, 1) lib.interception_destroy_context(context)
def anmelden(benutzer, pw): context = lib.interception_create_context() kstroke = ffi.new('InterceptionKeyStroke *') for key in benutzer: kstroke.code = SCANCODE.anmeldedaten[key] lib.interception_send(context, 1, kstroke, 1) kstroke.code = SCANCODE.TAB lib.interception_send(context, 1, kstroke, 1) for key in pw: kstroke.code = SCANCODE.anmeldedaten[key] lib.interception_send(context, 1, kstroke, 1)
def __init__(self, code, state): self.code = code self.state = state self.c = ffi.new('InterceptionKeyStroke *', {'code': code, 'state': state})[0]
if __name__ == '__main__': import sys program_instance = try_open_single_program('407631B6-78D3-4EFC-A868-40BBB7204CF1') if not program_instance: sys.exit() raise_process_priority() context = lib.interception_create_context() lib.interception_set_filter(context, lib.interception_is_keyboard, lib.INTERCEPTION_FILTER_KEY_DOWN | lib.INTERCEPTION_FILTER_KEY_UP) kstroke = ffi.new('InterceptionKeyStroke *') while True: device = lib.interception_wait(context) if not lib.interception_receive(context, device, kstroke, 1): break kstrokes = caps2esc(kstroke[0]) if kstrokes: lib.interception_send(context, device, ffi.new('InterceptionKeyStroke []', kstrokes), len(kstrokes)) lib.interception_destroy_context(context) close_single_program(program_instance)
# x=0 # a = [] # while x < i: # t = time.time() # r = pyautogui.pixelMatchesColor(int(ench_window_x + 83),int(ench_window_y + 382), (230, 217, 190)) # a.append(time.time() - t) # x = x + 1 # print(str(not r)+' Pixelmatching: ' + str(sum(a) / len(a))) # if pyautogui.pixelMatchesColor(desktop_size[0],desktop_size[1], (240, 240, 240)): # print('Speicherfehlermeldung auf dem Bildschirm - starte neu.') # while pyautogui.pixelMatchesColor(desktop_size[0],desktop_size[1], (240, 240, 240)): # pyautogui.moveTo(pyautogui.locateCenterOnScreen(path + 'pic\\OK_Error.png',grayscale=True, confidence=.88)) # mausklick() # time.sleep(1) # mausklick() raise_process_priority() context = lib.interception_create_context() lib.interception_set_filter(context, lib.interception_is_keyboard, lib.INTERCEPTION_FILTER_KEY_ALL) stroke = ffi.new('InterceptionKeyStroke *') while True: device = lib.interception_wait(context) if stroke.code == SCANCODE.SCANCODE_ESC: print('ESC') lib.interception_destroy_context(context)
return INTERCEPTION_MAX_KEYBOARD + index + 1 if __name__ == '__main__': raise_process_priority() context = lib.interception_create_context() lib.interception_set_filter( context, lib.interception_is_keyboard, lib.INTERCEPTION_FILTER_KEY_DOWN | lib.INTERCEPTION_FILTER_KEY_UP) lib.interception_set_filter(context, lib.interception_is_mouse, lib.INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_DOWN) stroke = ffi.new('InterceptionMouseStroke *') while True: device = lib.interception_wait(context) if not lib.interception_receive(context, device, stroke, 1): break if lib.interception_is_keyboard(device): kstroke = ffi.cast('InterceptionKeyStroke *', stroke) print('INTERCEPTION_KEYBOARD({})'.format(device - INTERCEPTION_KEYBOARD(0))) if kstroke.code == SCANCODE_ESC: break elif lib.interception_is_mouse(device): print('INTERCEPTION_MOUSE({})'.format(device - INTERCEPTION_MOUSE(0))) else:
SCANCODE_ESC = 0x01 if __name__ == '__main__': raise_process_priority() context = lib.interception_create_context() lib.interception_set_filter( context, lib.interception_is_keyboard, lib.INTERCEPTION_FILTER_KEY_DOWN | lib.INTERCEPTION_FILTER_KEY_UP) lib.interception_set_filter(context, lib.interception_is_mouse, lib.INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_DOWN) hardware_id = ffi.new('wchar_t[500]') stroke = ffi.new('InterceptionMouseStroke *') while True: device = lib.interception_wait(context) if not lib.interception_receive(context, device, stroke, 1): break if lib.interception_is_keyboard(device): kstroke = ffi.cast('InterceptionKeyStroke *', stroke) if kstroke.code == SCANCODE_ESC: break length = lib.interception_get_hardware_id(context, device, hardware_id, ffi.sizeof(hardware_id)) if 0 < length < ffi.sizeof(hardware_id):