Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am working to automate an application called MEmu Instance Manager.

For my project, I want to return the amount of instances that exist, along with their names with the pywinauto module and the inspect tool from windows kit.

Based on the Inspect tool, the MEmu application is structured like this

MainWindow
    Parent
        Child1
        InstanceArea
            TARGET
            WIDGETS

When inspecting the target widgets with the inspect tool, this is what I get.

The string that I am trying to return is "b__"

How can you use python to return the Legacy|Accessible.Value string? Does the path of the widget need to be specified before doing this?

If so, how? I've read a lot of useful information on the pywinauto guide, but I'm having trouble applying it on MEmu with the information I am getting from inspect.

For example,

with the information above, I cannot refer to this window with the info provided.

I am a beginner and I've been working on this for a couple of days, and getting nowhere with this. plz help *cries a lil

from pywinauto import Application
app = Application(backend="uia").connect(title='MainWindow')
# app.MainWindow.dump_tree() # useful to get child_window spec for just a copy-paste!
target = app.MainWindow.child_window(title='TARGET', control_type='Edit').wrapper_object()
# maybe try control_type='Text' depending on info from Inspect.exe
# when you found the control, just get the text
target.legacy_properties()['Value'] # .legacy_properties() returns a dict

I've not checked it with real app instance. Hope you could adjust it on the edges.

thanks for your response. i'm not really understanding app.MainWindow.dump_tree() when I run this in my script, it returns Control Identifiers: Qt5QWindowIcon - 'MEmuConsole' (L1071, T378, R1803, B870) ['Qt5QWindowIcon', 'MEmuConsoleQt5QWindowIcon', 'MEmuConsole'] child_window(title="MEmuConsole", class_name="Qt5QWindowIcon") i dont think im getting child windows within child window. – B Food Feb 19, 2019 at 0:02 it's as if the MEmu app is hiding the path where you can find (in my case) the "target" child window. I say this because, when I search for the child window through the main window, it leads me to a dead end where i stop at the InstanceArea. there is nothing beyond that. BUT when i go from the child window(by clicking edit name), up, i am in the right path. – B Food Feb 19, 2019 at 1:17 Well, it's pretty often case for Qt5 apps. We've implemented method .from_point(x, y) that can help to find such a "hidden" children elements. It will be available in 0.6.6 soon. Or you can install pywinauto from master branch. – Vasily Ryabov Feb 19, 2019 at 20:52 Also make sure you're connected to the right process: get app.MainWindow.process_id() and compare with Inspect.exe property ProcessID for the target. Though child elements search should work across process bounds, the target might be a child of another top window. – Vasily Ryabov Feb 19, 2019 at 20:54 awesome! looking foward to 0.6.6. I matched the id from app.MainWindow.proccess_id() and it matches with the ProcessID from Inspect. All children window also have the same ID. – B Food Feb 19, 2019 at 23:01

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.