def move_right_click(pos, move_back=False): origx, origy = get_mpos() set_mpos(pos) FInputs = Input * 2 extra = c_ulong(0) ii_ = Input_I() ii_.mi = MouseInput(0, 0, 0, MOUSEEVENTF_RIGHTDOWN, 0, pointer(extra)) tt.sleep(0.1) ii2_ = Input_I() ii2_.mi = MouseInput(0, 0, 0, MOUSEEVENTF_RIGHTUP, 0, pointer(extra)) x = FInputs((0, ii_), (0, ii2_)) windll.user32.SendInput(2, pointer(x), sizeof(x[0])) if move_back: set_mpos((origx, origy)) return origx, origy
def main(): # KeyDown and KeyUp ch = 'a' tt.sleep(1) down_up(ch) # select all tt.sleep(1) PressKey(vk.ctrl) PressKey(vk.a) tt.sleep(0.5) ReleaseKey(vk.a) ReleaseKey(vk.ctrl) return 1
) return ret if __name__ == '__main__': # tt.sleep(1) # move_click(get_mpos()) # tt.sleep(1) # move_right_click(get_mpos()) # # def hex_to_dec(int_hex): # if (isinstance(int_hex, (int, float))): # int_hex = str(int_hex) # int_dec = int(int_hex, 16) # return int_dec tt.sleep(1) scancode_down_up('a') tt.sleep(0.1) keybd_event('a') # @tt.run_f_with_during(5, 1) # def f(): # sendkey(scancode=scancodes.get('e')) # tt.sleep(0.01) # sendkey(scancode=scancodes.get('w')) # tt.sleep(0.01) # sendkey(scancode=scancodes.get('q')) # f() # # tt.sleep(1)
ii_.ki = KeyBdInput(0, 0, flag, 0, pointer(extra)) InputBox = FInputs((1, ii_)) if scancode is None: return InputBox[0].ii.ki.wScan = scancode InputBox[0].ii.ki.dwFlags = 0x8 if not (pressed): InputBox[0].ii.ki.dwFlags |= 0x2 windll.user32.SendInput(1, pointer(InputBox), sizeof(InputBox[0])) if __name__ == '__main__': tt.sleep(1) move_click(get_mpos()) tt.sleep(1) move_right_click(get_mpos()) def hex_to_dec(int_hex): if (isinstance(int_hex, (int, float))): int_hex = str(int_hex) int_dec = int(int_hex, 16) return int_dec class ScanCode: q = hex_to_dec(10) w = hex_to_dec(11) e = hex_to_dec(12) r = hex_to_dec(13)
def down_up(ch, t=0.5): ch = vk.conv_ord(ch) PressKey(ch) tt.sleep(t) ReleaseKey(ch) return 1