i'm currently doing pyautogui with python, so i created a script in notepad like this-
import pyautogui
numberdecider = "aa"
for char in numberdecider:
pyautogui.write("Hello World!", interval=2.0)
So I went in command prompt and I wrote
pythonw script.py
Which ran my script in the background. What command should I use to stop this script using cmd because now whenever I try to type something it keeps typing "Hello World." in between.
Try adding sys.exit
for keyboard interrupt like this:
import sys
import pyautogui
try:
numberdecider = "aa"
for char in numberdecider:
pyautogui.write("Hello World!", interval=2.0)
except KeyboardInterrupt:
sys.exit()
When you press ctrl+c
in cmd it should stop the script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.