Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import win32api, win32con
- def key_press(key): # presses a key according to keycodes
- win32api.keybd_event(key, 0, 2, 0)
- win32api.keybd_event(key, 0, 1, 0)
- def mouse_l_down(x,y): # left-mouse down
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
- def mouse_l_up(x,y): # left-mouse up
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
- def mouse_r_down(x,y): # right-mouse down
- win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x,y,0,0)
- def mouse_r_up(x,y): # right-mouse up
- win32pi.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,x,y,0,0)
- def click(x, y): # left-clicks
- mouse_l_down(x,y)
- mouse_l_up(x,y)
- def rclick(x,y): # right-clicks
- mouse_r_down(x,y)
- mouse_r_up(x,y)
- def cursor_loc(): # finds the cursor's location
- location = win32api.GetCursorPos()
- return location
- def set_cursor_loc(x,y): # sets the cursor's location
- win32api.SetCursorPos((x,y))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement