Working with app in windows background via Pywinauto

Issue

Good day!!

The question is to understand how Windows processors work when folded.
Closer to the point!

Tools

python3 (keyboard,pywinauto), win10-64bit

Task

There is a program, it is minimized in the third window. The whole GUI is an input, a submit button, and determining the network status( Online, Disconnect, Ready, Wait )
Through pywinauto I read the status, and if necessary, enter data through the keyboard

Problem

The program works fully when the application is visually displayed, but as soon as it is in the third window, then pywinauto becomes inactive. Doesn’t even work method set_focus()

Some Code

"Crutch" which I use so that the departure is not in a collapsed position


from pywinauto.timings import Timings
Timings.window_find_timeout = 120

Application initialization


    def __start_soft(self, path: str) -> pywinauto.Application:
        print(f"Soft Started... {self.user_named_App}")
        pywinauto.Application(backend="uia").start(path)
        return pywinauto.Application(backend="uia").connect(path=path, visible_only=False)

Access to status


status: pywinauto.Application.WindowSpecification =
self.active_App.AccountingTimeArrival.child_window(
auto_id="58464", control_type="StatusBar" ).Static

Thoughts

I am well aware that I am not that strong in programming, but looking at other applications, I know that there is some way to interact with the application in a minimized form. However, I think that pywinauto is able to interact directly with the GUI. Perhaps there are alternative methods to solve this problem. I will be glad to any criticism and answers, more experienced users!

Solution

Solution:

The solution is to use backend=win32 to solve this problem. However, it is worth noting that libraries such as keyboards and pynput should not be used. In pywinauto as an example:

app.send_chars()

An efficient way to use applications in the background. There are no better alternatives for my task.

Answered By – AnnaBrown

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published