# Ensure you have pyautogui installed: pip install pyautogui

except KeyboardInterrupt: print("\nStopped by user.")

# Hypothetical farm function while True: # Example action: Left mouse click pyautogui.click(button='left') time.sleep(1) # Wait 1 second between actions