Advertisement
tabnation

python mouse move and keyboard

Dec 22nd, 2021
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None
  1. #pip install pyautogui
  2. import pyautogui
  3. import time
  4.  
  5. # click at x and y
  6. pyautogui.click(500, 500, duration=1)
  7.  
  8. # wait 5 seconds
  9. time.sleep(5)
  10.  
  11. #move mouse to x and y
  12. pyautogui.moveTo(450, 450, duration=5)
  13.  
  14. #move mouse while holding left
  15. pyautogui.dragRel(100, 0, duration=5)
  16.  
  17. #scroll up and down
  18. pyautogui.scroll(-400)
  19. pyautogui.scroll(450)
  20.  
  21. # Keyboard functions
  22. pyautogui.click(400, 700, duration=1)
  23. pyautogui.typewrite('TabNation')
  24.  
  25. #hotkeys keyboard
  26. pyautogui.hotkey('ctrlleft', 'a')
Advertisement
RAW Paste Data Copied
Advertisement