I'm relatively new to coding, and I made this program to repeat mouse strokes when I am on a certain webpage so that the process can be automated.
import pyautogui, time
inp = raw_input("Number input?")
iterations = raw_input("Iterations?")
def move(x, y):
    pyautogui.moveTo(x, y)
for i in range(int(iterations)):
    move(540,515)
    pyautogui.click()
    move(690,760)
    pyautogui.click()
    pyautogui.typewrite(inp)
    move(1200,790)
    pyautogui.click()
    move(1200,340)
    pyautogui.click()
If I inputted too many iterations or I need to control my mouse again before the iterations are complete, is there a way to stop the loop/iterations? I tried to use CTRL+BREAK, but it didn't stop the loop. I also tried to add KeyboardInterrupt by using CTRL+C, but I couldn't figure out how to do it for my script.
 
    