JohnQi

Untitled

Oct 28th, 2021
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. from threading import Event
  2. from time import sleep
  3. import pyautogui
  4. import keyboard
  5.  
  6. hotkey = 'F4'
  7.  
  8. running = Event()
  9. running.clear()
  10.  
  11. def handle_key_event(event):
  12.     if event.event_type == 'down':
  13.         if running.is_set():
  14.             running.clear()
  15.         else:
  16.             running.set()
  17.  
  18. keyboard.hook_key(hotkey, handle_key_event)
  19.  
  20. while True:
  21.     if not running.is_set():
  22.         running.wait()  
  23.     pyautogui.click()
  24.     sleep(0.1)
  25.     pyautogui.press('q')
  26.     pyautogui.press('i')
  27.     pyautogui.click()
  28.     sleep(0.1)
  29.     pyautogui.press('q')
  30.     pyautogui.press('i')
  31.    
  32.      
  33.  
Advertisement
Add Comment
Please, Sign In to add comment