Nov-05-2020, 09:34 AM
I am trying to create a script that will cycle through 4 open windows. I am able to connect to the open windows fine. But I cannot figure out how to set_focus() on a window. I have read the documentation and googled, but cannot figure out what I am missing. I appreciate the advice.
My existing code is:
My existing code is:
import pywinauto
apps = []
windows = pywinauto.Desktop(backend="uia").windows()
for w in windows:
if 'Microsoft' in w.window_text():
apps.append(pywinauto.Application().connect(handle=w.handle))
for x in apps:
x.set_focus()
#I also tried:
pywinauto.set_focus(x)
