You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Wiki/05.2.-Theory-&-practice.-De...

250 lines
11 KiB

Here you can find the docs and examples of the OpenRPA desktop app access.
# Definitions
**UIO** - UI Object (class of pywinauto UI object) [pywinauto.base_wrapper]<br>
**UIOSelector** - List of dict (key attributes)<br>
**PWA** - PyWinAuto<br>
**PWASpecification** - List of dict (key attributes in pywinauto.find_window notation)<br>
**UIOTree** - Recursive Dict of Dict ... (UI Parent -> Child hierarchy)<br>
**UIOInfo** - Dict of UIO attributes<br>
**UIOActivity** - Activity of the UIO (UI object) from the Pywinauto module<br>
**UIOEI** - UI Object info object
# UIOSelector structure & examples
**Desciption**<br>
[<br>
&nbsp; &nbsp; {<br>
&nbsp; &nbsp; &nbsp; &nbsp; "index" - index of the UI element in parent child list,<br>
&nbsp; &nbsp; &nbsp; &nbsp; "depth_start" - глубина, с которой начинается поиск (по умолчанию 1),<br>
&nbsp; &nbsp; &nbsp; &nbsp; "depth_end" - глубина, до которой ведется поиск (по умолчанию 1),<br>
&nbsp; &nbsp; &nbsp; &nbsp; "class_name" - наименование класса, который требуется искать,<br>
&nbsp; &nbsp; &nbsp; &nbsp; "title" - наименование заголовка,<br>
&nbsp; &nbsp; &nbsp; &nbsp; "rich_text" - наименование rich_text,<br>
&nbsp; &nbsp; &nbsp; &nbsp; "backend": <"win32"||"uia", only for the 1-st list element> - if not specified, use mDefaultPywinautoBackend<br>
&nbsp; &nbsp; &nbsp; &nbsp; "is_enabled": <bool> - признак, что элемент доступен для выполнения действий,<br>
&nbsp; &nbsp; &nbsp; &nbsp; "is_visible": <bool> - признак, что элемент отображается на экране,<br>
&nbsp; &nbsp; },<br>
&nbsp; &nbsp; { ... }<br>
]<br>
**Example**
> [{"title":"Настройка периода","class_name":"V8NewLocalFrameBaseWnd","backend":"uia"},{"ctrl_index":0},{"ctrl_index":0},{"ctrl_index":5}]
# The UIDesktop module (OpenRPA/Robot/UIDesktop.py)
The UIDesktop is extension of the pywinauto module which provide access to the desktop apps by the **win32** and **ui automation** dll frameworks (big thx to the Microsoft :) ).
## Functions
*Naming convention: \<InArgument\>\_\<ActivityName\>\_\<OutArgument - if exist>*<br>
### List
- [UIOSelector_Get_UIOList](#UIOSelector_Get_UIOList)
- [UIOSelector_Get_UIO](#UIOSelector_Get_UIO)
- [UIOSelector_Exist_Bool](#UIOSelector_Exist_Bool)
- [UIOSelectorsSecs_WaitAppear_List](#UIOSelectorsSecs_WaitAppear_List)
- [UIOSelectorsSecs_WaitDisappear_List](#UIOSelectorsSecs_WaitDisappear_List)
- [UIOSelectorSecs_WaitAppear_Bool](#UIOSelectorSecs_WaitAppear_Bool)
- [UIOSelectorSecs_WaitDisappear_Bool](#UIOSelectorSecs_WaitDisappear_Bool)
- [UIOSelector_Get_BitnessInt](#UIOSelector_Get_BitnessInt)
- [UIOSelector_SearchChildByMouse_UIO](#UIOSelector_SearchChildByMouse_UIO)
- [UIOSelector_SearchChildByMouse_UIOTree](#UIOSelector_SearchChildByMouse_UIOTree)
- [UIOSelector_Get_UIOInfoList](#UIOSelector_Get_UIOInfoList)
- [UIOSelector_IsExist_Bool](#UIOSelector_IsExist_Bool)
- [UIOSelector_WaitAppear_Dict](#UIOSelector_WaitAppear_Dict)
- [UIOSelector_TryRestore_Dict](#UIOSelector_TryRestore_Dict)
- [UIOSelector_Get_UIOActivityList](#UIOSelector_Get_UIOActivityList)
- [UIOSelectorUIOActivity_Run_Dict](#UIOSelectorUIOActivity_Run_Dict)
- [UIOSelector_Get_UIOInfo](#UIOSelector_Get_UIOInfo)
- [UIOSelector_GetChildList_UIOList](#UIOSelector_GetChildList_UIOList)
- [UIOSelector_SearchUIONormalize_UIOSelector](#UIOSelector_SearchUIONormalize_UIOSelector)
- [UIOSelector_SearchProcessNormalize_UIOSelector](#UIOSelector_SearchProcessNormalize_UIOSelector)
- [UIOSelector_FocusHighlight](#UIOSelector_FocusHighlight)
- [UIOSelector_Highlight](#UIOSelector_Highlight)
### Description
**`UIOSelector_Get_UIOList (inSpecificationList,inElement=None,inFlagRaiseException=True)`**<br>
<a name="UIOSelector_Get_UIOList"></a>
___
Get list of the UIO<br>
___
**inSpecificationList** - UIOSelector - List of dict (key attributes)<br>
**inElement** - UIO pywinauto Входной элемент - показатель, что не требуется выполнять коннект к процессу<br>
**inFlagRaiseException** - Флаг True - выкинуть ошибку в случае обнаружении пустого списка<br>
___
**`UIOSelector_Get_UIO (inSpecificationList,inElement=None,inFlagRaiseException=True)`**<br>
<a name="UIOSelector_Get_UIO"></a>
___
Get first (if more than one UIO are applied) UIO (UI Object) <br>
___
**inSpecificationList** - UIOSelector <br>
**inElement** - Входной элемент - показатель, что не требуется выполнять коннект к процессу <br>
**inFlagRaiseException** - Флаг True - выкинуть ошибку в случае обнаружении пустого списка <br>
___
**`UIOSelector_Exist_Bool (inSpecificationList)`**<br>
<a name="UIOSelector_Exist_Bool"></a>
___
Check if UIO exist (Identified by the UIOSelector) <br>
___
**inSpecificationList** - UIOSelector <br>
___
**`UIOSelectorsSecs_WaitAppear_List (inSpecificationListList,inWaitSecs,inFlagWaitAllInMoment=False)`**<br>
<a name="UIOSelectorsSecs_WaitAppear_List"></a>
___
Wait for UIO is appear (at least one of them or all at the same time). return: \[0,1,2\] - index of UIOSpecification, which is appear <br>
___
**inSpecificationListList** - !List! of the UIOSelector <br>
**inWaitSecs** - Время ожидания объекта в секундах <br>
**inFlagWaitAllInMoment** - доп. условие - ожидать появление всех UIOSelector одновременно <br>
___
**`UIOSelectorsSecs_WaitDisappear_List (inSpecificationListList,inWaitSecs,inFlagWaitAllInMoment=False)`**<br>
<a name="UIOSelectorsSecs_WaitDisappear_List"></a>
___
Wait for UIO is Disappear (at least one of them or all at the same time). return: \[0,1,2\] - index of UIOSpecification, which is Disappear <br>
___
**inSpecificationListList** - !List! of the UIOSelector <br>
**inWaitSecs** - Время ожидания пропажи объекта в секундах <br>
**inFlagWaitAllInMoment** - доп. условие - ожидать пропажу всех UIOSelector одновременно <br>
___
**`UIOSelectorSecs_WaitAppear_Bool (inSpecificationList,inWaitSecs)`**<br>
<a name="UIOSelectorSecs_WaitAppear_Bool"></a>
___
Wait for UIO is appear (at least one of them or all at the same time). return: Bool - True - UIO is appear. <br>
___
**inSpecificationList** - UIOSelector <br>
**inWaitSecs** - Время ожидания объекта в секундах <br>
___
**`UIOSelectorSecs_WaitDisappear_Bool (inSpecificationList,inWaitSecs)`**<br>
<a name="UIOSelectorSecs_WaitDisappear_Bool"></a>
___
Wait for UIO is disappear (at least one of them or all at the same time) . return: Bool - True - UIO is Disappear. <br>
___
**inSpecificationList** - UIOSelector<br>
**inWaitSecs** - Время ожидания пропажи объекта в секундах<br>
___
**`UIOSelector_Get_BitnessInt (inSpecificationList)`**<br>
<a name="UIOSelector_Get_BitnessInt"></a>
___
Get process bitness (32 or 64). return None (if Process not found), int 32, or int 64<br>
___
**inSpecificationList** - UIOSelector<br>
___
**`UIOSelector_SearchChildByMouse_UIO(inElementSpecification)`**<br>
<a name="UIOSelector_SearchChildByMouse_UIO"></a>
___
Run the search UIO by mouse hover event. result = pywinauto element wrapper instance or None <br>
___
**inElementSpecification** - UIOSelector (see description on the top of the document) <br>
___
**`UIOSelector_SearchChildByMouse_UIOTree(inElementSpecification)`**<br>
<a name="UIOSelector_SearchChildByMouse_UIOTree"></a>
___
Run the search UIO by mouse hover event. result = pywinauto element wrapper instance or None <br>
___
**inElementSpecification** - UIOSelector <br>
___
**`UIOSelector_Get_UIOInfoList (inSpecificationList,inElement=None)`**<br>
<a name="UIOSelector_Get_UIOInfoList"></a>
___
Получить список информационных объектов, который удовлетворяет условиям <br>
___
**inSpecificationList** - UIOSelector <br>
___
**`UIOSelector_IsExist_Bool (inSpecificationList)`**<br>
<a name="UIOSelector_IsExist_Bool"></a>
___
Check is the UIO/UIO's by the UIOSelector exist <br>
___
**inSpecificationList** - UIOSelector <br>
___
**`UIOSelector_WaitAppear_Dict(inSpecificationList,inTimeout=60)`**<br>
<a name="UIOSelector_WaitAppear_Dict"></a>
___
Wait for the UIO by the UIOSelector appear <br>
___
**inSpecificationList** - UIOSelector <br>
___
**`UIOSelector_TryRestore_Dict(inSpecificationList)`**<br>
<a name="UIOSelector_TryRestore_Dict"></a>
___
Try to restore (maximize) window, if it's was minimized. (особенность uia backend - он не может прицепиться к окну, если оно свернуто)<br>
___
**inSpecificationList** - UIOSelector <br>
___
**`UIOSelector_Get_UIOActivityList (inControlSpecificationArray)`**<br>
<a name="UIOSelector_Get_UIOActivityList"></a>
___
Get the list of the UI object activities<br>
___
**inControlSpecificationArray** - UIOSelector <br>
___
**`UIOSelectorUIOActivity_Run_Dict(inControlSpecificationArray,inActionName,inArgumentList=\[\],inkwArgumentObject={})`**<br>
<a name="UIOSelectorUIOActivity_Run_Dict"></a>
___
Run the activity in UIO (UI Object) <br>
___
**inControlSpecificationArray** - UIOSelector <br>
**inActionName** - UIOActivity (name) from Pywinauto<br>
___
**`UIOSelector_Get_UIOInfo(inControlSpecificationArray)`**<br>
<a name="UIOSelector_Get_UIOInfo"></a>
___
Get the UIO dict of the attributes <br>
___
**inControlSpecificationArray** - UIOSelector <br>
___
**`UIOSelector_GetChildList_UIOList(inControlSpecificationArray=\[\],inBackend=mDefaultPywinautoBackend)`**<br>
<a name="UIOSelector_GetChildList_UIOList"></a>
___
Get list of child UIO's by Parent UIOSelector<br>
___
**inControlSpecificationArray** - UIOSelector <br>
___
**`UIOSelector_SearchUIONormalize_UIOSelector (inControlSpecificationArray)`**<br>
<a name="UIOSelector_SearchUIONormalize_UIOSelector"></a>
___
Подготовить массив для обращения к поиску элементов <br>
___
**inControlSpecificationArray** - UIOSelector <br>
___
**`UIOSelector_SearchProcessNormalize_UIOSelector (inControlSpecificationArray)`**<br>
<a name="UIOSelector_SearchProcessNormalize_UIOSelector"></a>
___
Подготовить массив для обращения к поиску процесса (отличается от поиска элемента, т.к. данная функция нужна для нормализации спецификации для подключения к процессу с окнами)<br>
___
**inControlSpecificationArray** - UIOSelector <br>
___
**`UIOSelector_FocusHighlight(inSpecificationArray)`**<br>
<a name="UIOSelector_FocusHighlight"></a>
___
Set focus and highlight (draw outline) the element (in app) by the UIO selector.<br>
___
**inSpecificationArray** - UIOSelector <br>
___
**`UIOSelector_Highlight(inSpecificationArray)`**<br>
<a name="UIOSelector_Highlight"></a>
___
Highlight (draw outline) the element (in app) by the UIO selector.<br>
___
**inSpecificationArray** - UIOSelector <br>
___