Search code examples
python-3.xpywinauto

How to press windows key using pywinauto python


Hello I want to write a program to automate windows 10 but to do so I need to open startmenu by pressing windows key using pywinauto plz help


Solution

  • Use this:

    
    from pywinauto import Application
    
    Application().start(r'mmc printmanagement.msc') # Warning! it spawns child process
    
    # connect to that child process
    app = Application(backend="uia").connect(path='mmc.exe')
    
    # print main window with the title
    print(app.windows())
    
    app.PrintManagement.dump_tree() # print identifiers for further automation