2. Функции

Here you can find the functions description for interaction with desktop GUI applications

How to use both x32 and x64 python processes (it can be helpfully, if another app GUI is on another bitness than your app)

from pyOpenRPA.Robot import UIDesktop
#Section for robot init
lPyOpenRPA_SettingsDict = {
        "Python32FullPath": "..\\Resources\\WPy32-3720\\python-3.7.2\\python.exe", #Set from user: "..\\Resources\\WPy32-3720\\python-3.7.2\\OpenRPARobotGUIx32.exe"
        "Python64FullPath": "..\\Resources\\WPy64-3720\\python-3.7.2.amd64\\python.exe", #Set from user
        "Python32ProcessName": "pyOpenRPA_UIDesktopX32.exe", #Config set once
        "Python64ProcessName": "pyOpenRPA_UIDesktopX64.exe" #Config set once
}
# Init the pyOpenRPA configuration
UIDesktop.Utils.ProcessBitness.SettingsInit(lPyOpenRPA_SettingsDict)
# Now you can use pyOpenRPA with both bitness.

Functions:

Get_OSBitnessInt()

Detect OS bitness.

PWASpecification_Get_PWAApplication(…)

#Backend selection - attribute «backend» («win32» || «uia») in 1-st list element

PWASpecification_Get_UIO(…)

#Backend def selection - attribute «backend» («win32» || «uia») in 1-st list element #old name - GetControl

UIOSelectorSecs_WaitAppear_Bool(…)

Wait for UI object will appear in GUI for inWaitSecs seconds.

UIOSelectorSecs_WaitDisappear_Bool(…)

Wait for UI object will disappear in GUI for inWaitSecs seconds.

UIOSelectorUIOActivity_Run_Dict(…[, …])

Run the activity in UIO (UI Object)

UIOSelector_Exist_Bool(inUIOSelector)

Check if object is exist by the UIO selector.

UIOSelector_FocusHighlight(inUIOSelector)

Set focus and highlight (draw outline) the element (in app) by the UIO selector.

UIOSelector_GetChildList_UIOList([…])

Get list of child UIO’s by the parent UIOSelector

UIOSelector_Get_BitnessInt(inSpecificationList)

Detect process bitness by the UI Object UIO Selector.

UIOSelector_Get_BitnessStr(inSpecificationList)

Detect process bitness by the UI Object UIO Selector.

UIOSelector_Get_UIO(inSpecificationList[, …])

Get the pywinauto object by the UIO selector.

UIOSelector_Get_UIOActivityList(inUIOSelector)

Get the list of the UI object activities

UIOSelector_Get_UIOInfo(inUIOSelector)

Get the UIO dict of the attributes

UIOSelector_Get_UIOList(inSpecificationList)

Get the UIO list by the selector

UIOSelector_Highlight(inUIOSelector)

Highlight (draw outline) the element (in app) by the UIO selector.

UIOSelector_SafeOtherGet_Process(inUIOSelector)

Safe get other process or None if destination app is the other/same bitness

UIOSelector_SearchChildByMouse_UIO(…)

UIOSelector (see description on the top of the document) #old name - AutomationSearchMouseElement

UIOSelector_SearchChildByMouse_UIOTree(…)

!!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!!

UIOSelector_TryRestore_Dict(inSpecificationList)

Try to restore (maximize) window, if it’s minimized.

UIOSelectorsSecs_WaitAppear_List(…[, …])

Wait for many UI object will appear in GUI for inWaitSecs seconds.

UIOSelectorsSecs_WaitDisappear_List(…[, …])

Wait for many UI object will disappear in GUI for inWaitSecs seconds.

pyOpenRPA.Robot.UIDesktop.Get_OSBitnessInt()[исходный код]

Detect OS bitness.

Результат

int 32 or int 64

pyOpenRPA.Robot.UIDesktop.PWASpecification_Get_PWAApplication(inControlSpecificationArray)[исходный код]

#Backend selection - attribute «backend» («win32» || «uia») in 1-st list element

Параметры

inControlSpecificationArray – List of dict, dict in pywinauto.find_windows notation

Результат

process application object

pyOpenRPA.Robot.UIDesktop.PWASpecification_Get_UIO(inControlSpecificationArray)[исходный код]

#Backend def selection - attribute «backend» («win32» || «uia») in 1-st list element #old name - GetControl

Параметры

inControlSpecificationArray – List of dict, dict in pywinauto.find_windows notation

Результат

list of UIO object

pyOpenRPA.Robot.UIDesktop.UIOSelectorSecs_WaitAppear_Bool(inSpecificationList, inWaitSecs)[исходный код]

Wait for UI object will appear in GUI for inWaitSecs seconds.

Параметры
  • inSpecificationList – UIOSelector. Example: [{«title»:»notepad»},{«title»:»OK»}]

  • inWaitSecs – Float value (seconds) for wait UI element appear in GUI

Результат

True - UI object will appear. False - else case

pyOpenRPA.Robot.UIDesktop.UIOSelectorSecs_WaitDisappear_Bool(inSpecificationList, inWaitSecs)[исходный код]

Wait for UI object will disappear in GUI for inWaitSecs seconds.

Параметры
  • inSpecificationList – UIOSelector. Example: [{«title»:»notepad»},{«title»:»OK»}]

  • inWaitSecs – Float value (seconds) for wait UI element disappear in GUI

Результат

True - UI object will disappear. False - else case

pyOpenRPA.Robot.UIDesktop.UIOSelectorUIOActivity_Run_Dict(inUIOSelector, inActionName, inArgumentList=None, inkwArgumentObject=None)[исходный код]

Run the activity in UIO (UI Object)

Параметры
  • inUIOSelector – UIOSelector - List of items, which contains condition attributes

  • inActionName – UIOActivity (name) activity name string from Pywinauto

  • inArgumentList

  • inkwArgumentObject

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Exist_Bool(inUIOSelector)[исходный код]

Check if object is exist by the UIO selector.

Параметры

inUIOSelector

Результат

True - Object is exist. False - else case

pyOpenRPA.Robot.UIDesktop.UIOSelector_FocusHighlight(inUIOSelector)[исходный код]

Set focus and highlight (draw outline) the element (in app) by the UIO selector.

Параметры

inUIOSelector – UIOSelector - List of items, which contains condition attributes

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_GetChildList_UIOList(inUIOSelector=None, inBackend='win32')[исходный код]

Get list of child UIO’s by the parent UIOSelector

Параметры
  • inUIOSelector – UIOSelector - List of items, which contains condition attributes

  • inBackend – «win32» or «uia»

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_BitnessInt(inSpecificationList)[исходный код]

Detect process bitness by the UI Object UIO Selector.

Параметры

inSpecificationList – UIOSelector. Example: [{«title»:»notepad»},{«title»:»OK»}]

Результат

int 32 or int 64

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_BitnessStr(inSpecificationList)[исходный код]

Detect process bitness by the UI Object UIO Selector.

Параметры

inSpecificationList – UIOSelector. Example: [{«title»:»notepad»},{«title»:»OK»}]

Результат

str «32» or str «64»

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_UIO(inSpecificationList, inElement=None, inFlagRaiseException=True)[исходный код]

Get the pywinauto object by the UIO selector.

Параметры
  • inSpecificationList

  • inElement

  • inFlagRaiseException

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_UIOActivityList(inUIOSelector)[исходный код]

Get the list of the UI object activities

Параметры

inUIOSelector – UIOSelector - List of items, which contains condition attributes

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_UIOInfo(inUIOSelector)[исходный код]

Get the UIO dict of the attributes

Параметры

inUIOSelector – UIOSelector - List of items, which contains condition attributes

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Get_UIOList(inSpecificationList, inElement=None, inFlagRaiseException=True)[исходный код]

Get the UIO list by the selector

Параметры
  • inSpecificationList – UIO Selector

  • inElement – Входной элемент - показатель, что не требуется выполнять коннект к процессу

  • inFlagRaiseException – Флаг True - выкинуть ошибку в случае обнаружении пустого списка

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_Highlight(inUIOSelector)[исходный код]

Highlight (draw outline) the element (in app) by the UIO selector.

Параметры

inUIOSelector – UIOSelector - List of items, which contains condition attributes

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelector_SafeOtherGet_Process(inUIOSelector)[исходный код]

Safe get other process or None if destination app is the other/same bitness

Параметры

inUIOSelector – UIO Selector of the UI object

Результат

None or process (of the other bitness)

pyOpenRPA.Robot.UIDesktop.UIOSelector_SearchChildByMouse_UIO(inElementSpecification)[исходный код]

UIOSelector (see description on the top of the document) #old name - AutomationSearchMouseElement

Параметры

inElementSpecification – UIOSelector of the UI Object

Результат

pywinauto element wrapper instance or None

pyOpenRPA.Robot.UIDesktop.UIOSelector_SearchChildByMouse_UIOTree(inUIOSelector)[исходный код]

!!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!!

Параметры

inUIOSelector – UIOSelector of the UI Object

Результат

?

pyOpenRPA.Robot.UIDesktop.UIOSelector_TryRestore_Dict(inSpecificationList)[исходный код]

Try to restore (maximize) window, if it’s minimized. (!IMPORTANT! When use UIA framework minimized windows doesn’t appear by the UIOSelector. You need to try restore windows and after that try to get UIO)

Параметры

inSpecificationList – UIOSelector - List of items, which contains condition attributes

Результат

pyOpenRPA.Robot.UIDesktop.UIOSelectorsSecs_WaitAppear_List(inSpecificationListList, inWaitSecs, inFlagWaitAllInMoment=False)[исходный код]

Wait for many UI object will appear in GUI for inWaitSecs seconds.

Параметры
  • inSpecificationListList

    UIOSelector list. Example: [

    [{«title»:»notepad»},{«title»:»OK»}], [{«title»:»notepad»},{«title»:»Cancel»}]

    ]

  • inWaitSecs – Float value (seconds) for wait UI element appear in GUI

  • inFlagWaitAllInMoment – True - Wait all UI objects from the UIOSelector list to be appeared

Результат

List of index, which UI object UIO will be appeared. Example: [1] # Appear only UI object with UIO selector: [{«title»:»notepad»},{«title»:»Cancel»}]

pyOpenRPA.Robot.UIDesktop.UIOSelectorsSecs_WaitDisappear_List(inSpecificationListList, inWaitSecs, inFlagWaitAllInMoment=False)[исходный код]

Wait for many UI object will disappear in GUI for inWaitSecs seconds.

Параметры
  • inSpecificationListList

    UIOSelector list. Example: [

    [{«title»:»notepad»},{«title»:»OK»}], [{«title»:»notepad»},{«title»:»Cancel»}]

    ]

  • inWaitSecs – Float value (seconds) for wait UI element disappear in GUI

  • inFlagWaitAllInMoment – True - Wait all UI objects from the UIOSelector list to be disappeared.

Результат

List of index, which UI object UIO will be disappeared. Example: [1] # Disappear only UI object with UIO selector: [{«title»:»notepad»},{«title»:»Cancel»}]

Результат

References

reStructuredText 1

1

http://docutils.sourceforge.net/rst.html

.. v1.2.12 replace:: v1.2.12 .. |author| replace:: Ivan Maslov <ivan.maslov@unicodelabs.ru>