[Python] How to click using pywinauto

Discussão em 'Python' iniciado por Stack, Março 21, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to use pywinauto to control an image processing software.

    First, I need to click a specific area (which is used for image dragging) to pop up a windows for path input. See the first figure.

    Then, I need to input a path and click the button "Select Folder". See the second figure.

    I tried:

    from pywinauto import Desktop, Application, mouse, findwindows
    from pywinauto.keyboard import SendKeys

    app = Application(backend='uia').start(r"C:\Program Files\Duplicate Photo Cleaner\DuplicatePhotoCleaner.exe")
    app.connect(path="DuplicatePhotoCleaner.exe")
    app.DuplicatePhotoCleaner.print_control_identifiers()

    Control Identifiers:

    Dialog - 'Duplicate Photo Cleaner' (L440, T126, R1480, B915)
    ['Duplicate Photo Cleaner', 'Duplicate Photo CleanerDialog', 'Dialog']
    child_window(title="Duplicate Photo Cleaner", control_type="Window")
    |
    | TitleBar - '' (L464, T129, R1472, B157)
    | ['', 'TitleBar']
    | |
    | | Menu - 'System' (L448, T134, R470, B156)
    | | ['System', 'Menu', 'SystemMenu', 'System0', 'System1']
    | | child_window(title="System", auto_id="MenuBar", control_type="MenuBar")
    | | |
    | | | MenuItem - 'System' (L448, T134, R470, B156)
    | | | ['System2', 'SystemMenuItem', 'MenuItem']
    | | | child_window(title="System", control_type="MenuItem")
    | |
    | | Button - 'Minimize' (L1333, T127, R1380, B157)
    | | ['Minimize', 'Button', 'MinimizeButton', 'Button0', 'Button1']
    | | child_window(title="Minimize", control_type="Button")
    | |
    | | Button - 'Maximize' (L1380, T127, R1426, B157)
    | | ['Button2', 'Maximize', 'MaximizeButton']
    | | child_window(title="Maximize", control_type="Button")
    | |
    | | Button - 'Close' (L1426, T127, R1473, B157)
    | | ['CloseButton', 'Button3', 'Close']
    | | child_window(title="Close", control_type="Button")


    Can anyone help?

    Thank you very much.

    [​IMG]

    [​IMG]

    Continue reading...

Compartilhe esta Página