My solution to the Practice Project #1 in Chapter 18 of the excellent book “Automate the Boring Stuff with Python” (ABSP)
#! usr/bin/env python3 # by lorenzo - 23/10/2017 # script that nudges the mouse cursor slightly every ten seconds import pyautogui, time print("Move the cursor to the upper-left corner of the screen to stop.") pyautogui.FAILSAFE = True try: while True: pyautogui.moveRel(10, 0, duration=1) pyautogui.moveRel(-10, 0, duration=1) time.sleep(10) except pyautogui.FailSafeException: print("\nDone")
Comments about the code are welcome.