Is there a way to select a specific process via pid and have a script only input that process? New to python and I can't find this anywhere.
import keyboard
import time
import psutil
process_name = "NAME"
pid = None
for proc in psutil.process_iter():
if process_name in proc.name():
pid = proc.pid
print (process_name, proc.pid);
bot = 1
while bot:
keyboard.press_and_release('ctrl')
time.sleep(0.25)
bot += 1
My goal is to have this run while I browse online or do other work but I need the script to only run for a game I have installed. Instead of print am I able to have it concentrate on the game only? Hope this makes sense.