I am trying to automate the handeling of multiple applications. I can open a seccond application from the first one. I need to select the second window in order to be able to opperate it. I am currently able to do this, however the required time varies from 2 second to almost a minute. I know multiple factors influence this, like other progragramms running at the same time. Still I think the time which is required could be reduced by using a more efficient code.
I currently do this:
app = pywinauto.application.Application(backend="uia")
app.connect(path="Document-I-wish-to-find.exe")
mywindows = pywinauto.findwindows.find_windows(title_re=".*Firstpartofwindowname ")
app = pywinauto.application.Application().connect(handle=mywindows[0])
Is it faster if I don't search for Title but something else ? Or is there another method which I could use, with the same result ?
To speed it up use class_name keyword. It's faster because class_name can be obtained by 1 Win32 function call, while getting text requires sending 2 window messages to another process. pywinauto filters handles by class_name first, of course.