0

I'm using PyAutoGui for automation of adding data to certain fullscreen app. Problem is, when I try to Alt+Tab back to my IDE it constantly brings app back to front and messes up my code by pasting data there. I need a way to either prevent script from working when I press Alt+Tab or when window comes out of focus. How do I do that?

I tried: Ctrl-C Ctrl-Pause

import _thread

def input_thread(a_list):
    raw_input()             # use input() in Python3
    a_list.append(True)
    
def do_stuff():
    a_list = []
    _thread.start_new_thread(input_thread, (a_list,))
    while not a_list:
        stuff()
RickStead
  • 3
  • 2
  • I think it'd just be easier to detect that the active window is no longer the one you want to paste into. And only paste if it's the right window. https://stackoverflow.com/questions/10266281/obtain-active-window-using-python – Random Davis Dec 13 '22 at 21:56

0 Answers0