SHARE
TWEET

Untitled

a guest Apr 13th, 2018 577 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import ctypes
  2.  
  3. PUL = ctypes.POINTER(ctypes.c_ulong)
  4.  
  5. class KeyBdInput(ctypes.Structure):
  6.     _fields_ = [("wVk", ctypes.c_ushort),
  7.                 ("wScan", ctypes.c_ushort),
  8.                 ("dwFlags", ctypes.c_ulong),
  9.                 ("time", ctypes.c_ulong),
  10.                 ("dwExtraInfo", PUL)]
  11.  
  12.  
  13. class HardwareInput(ctypes.Structure):
  14.     _fields_ = [("uMsg", ctypes.c_ulong),
  15.                 ("wParamL", ctypes.c_short),
  16.                 ("wParamH", ctypes.c_ushort)]
  17.  
  18.  
  19. class MouseInput(ctypes.Structure):
  20.     _fields_ = [("dx", ctypes.c_long),
  21.                 ("dy", ctypes.c_long),
  22.                 ("mouseData", ctypes.c_ulong),
  23.                 ("dwFlags", ctypes.c_ulong),
  24.                 ("time", ctypes.c_ulong),
  25.                 ("dwExtraInfo", PUL)]
  26.  
  27.  
  28. class Input_I(ctypes.Union):
  29.     _fields_ = [("ki", KeyBdInput),
  30.                 ("mi", MouseInput),
  31.                 ("hi", HardwareInput)]
  32.  
  33. class Input(ctypes.Structure):
  34.     _fields_ = [("type", ctypes.c_ulong),
  35.                 ("ii", Input_I)]
  36.  
  37. def set_pos(x, y):
  38.     x = 1 + int(x * 65536./1920.)
  39.     y = 1 + int(y * 65536./1080.)
  40.     extra = ctypes.c_ulong(0)
  41.     ii_ = Input_I()
  42.     ii_.mi = MouseInput(x, y, 0, (0x0001 | 0x8000), 0, ctypes.pointer(extra))
  43.     command = Input(ctypes.c_ulong(0), ii_)
  44.     ctypes.windll.user32.SendInput(1, ctypes.pointer(command), ctypes.sizeof(command))
  45.  
  46. def left_click():
  47.     extra = ctypes.c_ulong(0)
  48.     ii_ = Input_I()
  49.     ii_.mi = MouseInput(0, 0, 0, 0x0002, 0, ctypes.pointer(extra))
  50.     x = Input(ctypes.c_ulong(0), ii_)
  51.     ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
  52.  
  53.     extra = ctypes.c_ulong(0)
  54.     ii_ = Input_I()
  55.     ii_.mi = MouseInput(0, 0, 0, 0x0004, 0, ctypes.pointer(extra))
  56.     x = Input(ctypes.c_ulong(0), ii_)
  57.     ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top