diff --git a/README.md b/README.md index ea14b3630..ccc2dbc3f 100644 --- a/README.md +++ b/README.md @@ -12,36 +12,63 @@ pywinauto is a set of python modules to automate the Microsoft Windows GUI. At it’s simplest it allows you to send mouse and keyboard actions to windows dialogs and controls, but it has support for more complex actions like getting text data. -Recommended usage: 64-bit Python is for 64-bit applications; 32-bit Python is for 32-bit ones. +Supported technologies under the hood: Win32 API (`backend="win32"`; used by default), +MS UI Automation (`backend="uia"`). User input emulation modules + `mouse` and `keyboard` work on both Windows and Linux. ### Setup * run `pip install -U pywinauto` (dependencies will be installed automatically) -### Example +### Examples It is simple and the resulting scripts are very readable. How simple? ```python from pywinauto.application import Application app = Application().start("notepad.exe") -app.UntitledNotepad.MenuSelect("Help->About Notepad") -app.AboutNotepad.OK.Click() -app.UntitledNotepad.Edit.TypeKeys("pywinauto Works!", with_spaces = True) +app.UntitledNotepad.menu_select("Help->About Notepad") +app.AboutNotepad.OK.click() +app.UntitledNotepad.Edit.type_keys("pywinauto Works!", with_spaces = True) +``` + +More detailed example for `explorer.exe` (using **MS UI Automation**): + +```python +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 ``` ### Documentation -* [Introduction](http://pywinauto.readthedocs.io/en/latest/) -* [Table of contents](http://pywinauto.readthedocs.io/en/latest/contents.html) -* [Change Log / History](http://pywinauto.readthedocs.io/en/latest/HISTORY.html) -* [HowTo's](http://pywinauto.readthedocs.io/en/latest/HowTo.html) +* [Latest documentation on ReadTheDocs](http://pywinauto.readthedocs.io/en/latest/) +* [Getting Started Guide](http://pywinauto.readthedocs.io/en/latest/getting_started.html) * [Code examples (gists) on gist.github.com](https://gist.github.com/vasily-v-ryabov) * [Mailing list](https://sourceforge.net/p/pywinauto/mailman/) -### Dependencies (if install manually): -* [pyWin32](http://sourceforge.net/projects/pywin32/files/pywin32/) only - -Optional packages: -* Install [Pillow](https://pypi.python.org/pypi/Pillow) (by `pip install -U Pillow`) to be able to call `CaptureAsImage()` method for making control's snapshot. +### Dependencies (if install manually) +* Windows: + - [pyWin32](http://sourceforge.net/projects/pywin32/files/pywin32/) + - [comtypes](https://github.com/enthought/comtypes) + - [six](https://pypi.python.org/pypi/six) +* Linux: + - [python-xlib](https://github.com/python-xlib/python-xlib) + - [six](https://pypi.python.org/pypi/six) +* Optional packages: + - Install [Pillow](https://pypi.python.org/pypi/Pillow) (by `pip install -U Pillow`) to be able to call `capture_as_image()` method for making control's snapshot. ### Packages required for running unit tests * [Pillow](https://pypi.python.org/pypi/Pillow) @@ -57,7 +84,8 @@ Pywinauto for native Windows GUI was initially written by **Mark Mc Mahon**. Mark brought many great ideas into the life using power of Python. Further contributors are inspired of the nice API so that the development continues. -Pywinauto 0.5.4 and before is distributed under the LGPL v2.1 or later. Starting from 0.6.0 pywinauto will be distributed under the BSD 3-clause license. +Starting from 0.6.0 pywinauto is distributed under the BSD 3-clause license. +Pywinauto 0.5.4 and before was distributed under the LGPL v2.1 or later. * (c) [The Open Source Community](https://github.com/pywinauto/pywinauto/graphs/contributors), 2015-2016 (0.6.0+ development) * (c) Intel Corporation, 2015 (led 0.5.x maintenance) * (c) Michael Herrmann, 2012-2013 (0.4.2) diff --git a/docs/code/code.txt b/docs/code/code.txt index 94212d787..7c748b81f 100644 --- a/docs/code/code.txt +++ b/docs/code/code.txt @@ -69,9 +69,6 @@ Backend Internal Implementation modules pywinauto.uia_defines.txt pywinauto.hooks.txt - pywinauto.uia_defines.txt - pywinauto.uia_defines.txt - pywinauto.uia_defines.txt Internal Modules ================