Skip to content

Instantly share code, notes, and snippets.

@Tset-Noitamotua
Created January 19, 2017 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tset-Noitamotua/8c3086dc3e7ccd0444b4637a3c62ee7c to your computer and use it in GitHub Desktop.
Save Tset-Noitamotua/8c3086dc3e7ccd0444b4637a3c62ee7c to your computer and use it in GitHub Desktop.
pywinauto examples
from pywinauto import Desktop, Application
Application().start('explorer.exe "C:\\Program Files"')
# connect to another process spawned by explorer.exe
app = Application(backend="uia").connect(path="explorer.exe", title="Program Files")
app.ProgramFiles.set_focus()
common_files = app.ProgramFiles.ItemsView.get_item('Common Files')
common_files.right_click_input()
app.ContextMenu.Properties.invoke()
# this dialog is open in another process (Desktop object doesn't rely on any process id)
Properties = Desktop(backend='uia').Common_Files_Properties
Properties.print_control_identifiers()
Properties.Cancel.click()
Properties.wait_not('visible') # make sure the dialog is closed
# origin of example: https://github.com/pywinauto/pywinauto/blob/master/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment