Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import ctypes
  2. MOUSEEVENTF_MOVE = 0x0001 # mouse move
  3. MOUSEEVENTF_ABSOLUTE = 0x8000 # absolute move
  4. MOUSEEVENTF_MOVEABS = MOUSEEVENTF_MOVE + MOUSEEVENTF_ABSOLUTE
  5.  
  6. MOUSEEVENTF_LEFTDOWN = 0x0002 # left button down
  7. MOUSEEVENTF_LEFTUP = 0x0004 # left button up
  8. MOUSEEVENTF_CLICK = MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP
  9.  
  10. def click(x, y):
  11. x = 65536L * x / ctypes.windll.user32.GetSystemMetrics(0) + 1
  12. y = 65536L * y / ctypes.windll.user32.GetSystemMetrics(1) + 1
  13. ctypes.windll.user32.mouse_event(MOUSEEVENTF_MOVEABS, x, y, 0, 0)
  14. ctypes.windll.user32.mouse_event(MOUSEEVENTF_CLICK, 0, 0, 0, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement