import time
import pyautogui
def rapid_click_for_300_seconds(interval: float = 0.01) -> None:
pyautogui.FAILSAFE = True
print("Clicking will start in 2 seconds...")
time.sleep(2)
print("Clicking started. Move the cursor wherever you want.")
end_time = time.monotonic() + 300
try:
while time.monotonic() < end_time:
pyautogui.click()
#time.sleep(interval)
except pyautogui.FailSafeException:
print("Stopped because the cursor was moved to a screen corner.")
return
print("Finished clicking.")
if __name__ == "__main__":
rapid_click_for_300_seconds()
Automation script