Windows is a library for managing the Windows operating system.
DEPRECATION WARNING! USE RPA.Windows library instead.
For Windows desktop automation Robocorp recommends the RPA.Windows library.
No further updates will be released for this library and new functionality will continue to be developed in RPA.Windows library.
Running Windows applications
Windows applications can be started in several ways. The library supports the following keywords:
- Open Application (dispatch Office applications)
- Open File (open the file as process which opens the associated application)
- Open Executable (uses pywinauto start)
- Open Using Run Dialog (uses Windows run dialog)
- Open From Search (uses Windows search dialog)
Locator is used to identify the element for interaction - usually for a mouse click.
Locators can investigated for application once it has been opened by calling the keyword get_windows_elements which can store locator information into JSON file and screenshot of the element into an image file.
The element needs to be identified by a unique method, for example, "Three" for button 3 in the Calculator application. It can be given either as Three or name:Three.
Possible search criterias:
- class (class_name)
- type (control_type)
- id (automation_id)
- any if none was defined
The current method of inspecting elements on Windows is inspect.exe which is part of Windows SDK.
The keyword send_keys can be used to send keys to the active window. The keyword type_keys sends keys to the active window element.
Special key codes are documented on pywinauto documentation page.
- I see error message AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'CLSIDToClassMap'
- From PowerShell run this command: Remove-Item -path $env:LOCALAPPDATATempgen_py -recurse
Initialize self. See help(type(self)) for accurate signature.