diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index 620b8576..aecf6680 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -51,7 +51,7 @@ def AgentActivityItemAdd(inGSettings, inHostNameStr, inUserStr, inActivityItemDi def AgentOSCMD(inGSettings, inHostNameStr, inUserStr, inCMDStr, inRunAsyncBool=True): """ - pyOpenRPA.Agent: Send CMD to OS. Result return to log + Orchestrator by the A2O connection + Send CMD to OS throught the pyOpenRPA.Agent daemon. Result return to log + Orchestrator by the A2O connection def OSCMD(inCMDStr, inRunAsyncBool=True, inGSettings=None): Send to agent activity item to OSCMD @@ -855,7 +855,7 @@ def ProcessStop(inProcessNameWOExeStr, inCloseForceBool, inUserNameStr = "%usern def ProcessListGet(inProcessNameWOExeList=None): """ - Return process list on the orchestrator machine. You can determine the list of the processes you are interested - def will return the list about it. + Return process list on the orchestrator machine sorted by Memory Usage. You can determine the list of the processes you are interested - def will return the list about it. .. code-block:: python @@ -863,7 +863,8 @@ def ProcessListGet(inProcessNameWOExeList=None): from pyOpenRPA import Orchestrator lProcessList = Orchestrator.ProcessListGet() - # Return the list of the process on the machine. !ATTENTION! RUn orchestrator as administrator to get all process list on the machine. + # Return the list of the process on the machine. + # !ATTENTION! RUn orchestrator as administrator to get all process list on the machine. :param inProcessNameWOExeList: :return: { @@ -881,7 +882,6 @@ def ProcessListGet(inProcessNameWOExeList=None): """ if inProcessNameWOExeList is None: inProcessNameWOExeList = [] - '''Get list of running process sorted by Memory Usage and filtered by inProcessNameWOExeList''' lMapUPPERInput = {} # Mapping for processes WO exe lResult = {"ProcessWOExeList":[], "ProcessWOExeUpperList":[],"ProcessDetailList":[]} # Create updated list for quick check @@ -913,14 +913,28 @@ def ProcessListGet(inProcessNameWOExeList=None): # Python def - start module function def PythonStart(inModulePathStr, inDefNameStr, inArgList=None, inArgDict=None, inLogger = None): """ - Python import module and start def + Import module and run def in the Orchestrator process. - :param inModulePathStr: - :param inDefNameStr: - :param inArgList: - :param inArgDict: - :param inLogger: - :return: + .. note:: + + Import module will be each time when PythonStart def will be called. + + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + Orchestrator.PythonStart( + inModulePathStr="ModuleToCall.py", # inModulePathStr: Working Directory\\ModuleToCall.py + inDefNameStr="TestDef") + # Import module in Orchestrator process and call def "TestDef" from module "ModuleToCall.py" + + :param inModulePathStr: Absolute or relative (working directory of the orchestrator process) path to the importing module .py + :param inDefNameStr: Def name in module + :param inArgList: List of the arguments for callable def + :param inArgDict: Dict of the named arguments for callable def + :param inLogger: Logger instance to log some information when PythonStart def is running + :return: None """ if inArgList is None: inArgList=[] if inArgDict is None: inArgDict={} @@ -931,23 +945,42 @@ def PythonStart(inModulePathStr, inDefNameStr, inArgList=None, inArgDict=None, i except Exception as e: if inLogger: inLogger.exception("Loop activity error: module/function not founded") -# # # # # # # # # # # # # # # # # # # # # # # - # # # # # # # # # # # # # # # # # # # # # # # # Scheduler # # # # # # # # # # # # # # # # # # # # # # # def SchedulerActivityTimeAddWeekly(inGSettings, inTimeHHMMStr="23:55:", inWeekdayList=None, inActivityList=None): """ - Add activity in time weekly + Add activity item list in scheduler. You can set weekday list and set time when launch. Activity list will be executed at planned time/day. + + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + # EXAMPLE 1 + def TestDef(inArg1Str): + pass + lActivityItem = Orchestrator.ProcessorActivityItemCreate( + inDef = TestDef, + inArgList=[], + inArgDict={"inArg1Str": "ArgValueStr"}, + inArgGSettingsStr = None, + inArgLoggerStr = None) + Orchestrator.SchedulerActivityTimeAddWeekly( + inGSettings = gSettingsDict, + inTimeHHMMStr = "04:34", + inWeekdayList=[2,3,4], + inActivityList = [lActivityItem]) + # Activity will be executed at 04:34 Wednesday (2), thursday (3), friday (4) :param inGSettings: Global settings dict (singleton) - :param inTimeHHMMStr: - :param inWeekdayList: - :param inActivityList: - :return: + :param inTimeHHMMStr: Activation time from "00:00" to "23:59". Example: "05:29" + :param inWeekdayList: Week day list to initiate activity list. Use int from 0 (monday) to 6 (sunday) as list items. Example: [0,1,2,3,4]. Default value is everyday ([0,1,2,3,4,5,6]) + :param inActivityList: Activity list structure + :return: None """ - if inWeekdayList is None: inWeekdayList=[] + if inWeekdayList is None: inWeekdayList=[0,1,2,3,4,5,6] if inActivityList is None: inActivityList=[] Processor.__ActivityListVerify__(inActivityList=inActivityList) # DO VERIFICATION FOR THE inActivityList lActivityTimeItemDict = { @@ -965,18 +998,64 @@ def SchedulerActivityTimeAddWeekly(inGSettings, inTimeHHMMStr="23:55:", inWeekda def RDPTemplateCreate(inLoginStr, inPasswordStr, inHostStr="127.0.0.1", inPortInt = 3389, inWidthPXInt = 1680, inHeightPXInt = 1050, inUseBothMonitorBool = False, inDepthBitInt = 32, inSharedDriveList=None): """ - Create some RDP template dict to use it when connect/reconnect + Create RDP connect dict item/ Use it connect/reconnect (Orchestrator.RDPSessionConnect) - :param inLoginStr: - :param inPasswordStr: - :param inHostStr: - :param inPortInt: - :param inWidthPXInt: - :param inHeightPXInt: - :param inUseBothMonitorBool: - :param inDepthBitInt: - :param inSharedDriveList: + .. code-block:: python + + # USAGE + from pyOpenRPA import Orchestrator + + lRDPItemDict = Orchestrator.RDPTemplateCreate( + inLoginStr = "USER_99", + inPasswordStr = "USER_PASS_HERE", + inHostStr="127.0.0.1", + inPortInt = 3389, + inWidthPXInt = 1680, + inHeightPXInt = 1050, + inUseBothMonitorBool = False, + inDepthBitInt = 32, + inSharedDriveList=None) + # lRDPTemplateDict= { # Init the configuration item + # "Host": "127.0.0.1", "Port": "3389", "Login": "USER_99", "Password": "USER_PASS_HERE", + # "Screen": { "Width": 1680, "Height": 1050, "FlagUseAllMonitors": False, "DepthBit": "32" }, + # "SharedDriveList": ["c"], + # ###### Will updated in program ############ + # "SessionHex": "77777sdfsdf77777dsfdfsf77777777", # Hex is created when robot runs, example "" + # "SessionIsWindowExistBool": False, "SessionIsWindowResponsibleBool": False, "SessionIsIgnoredBool": False + # } + + :param inLoginStr: User/Robot Login, example "USER_99" + :param inPasswordStr: Password, example "USER_PASS_HERE" + :param inHostStr: Host address, example "77.77.22.22" + :param inPortInt: RDP Port, example "3389" (default) + :param inWidthPXInt: Width of the remote desktop in pixels, example 1680 + :param inHeightPXInt: Height of the remote desktop in pixels, example 1050 + :param inUseBothMonitorBool: True - connect to the RDP with both monitors. False - else case + :param inDepthBitInt: Remote desktop bitness. Available: 32 or 24 or 16 or 15, example 32 + :param inSharedDriveList: Host local disc to connect to the RDP session. Example: ["c", "d"] :return: + { + "Host": inHostStr, # Host address, example "77.77.22.22" + "Port": str(inPortInt), # RDP Port, example "3389" + "Login": inLoginStr, # Login, example "test" + "Password": inPasswordStr, # Password, example "test" + "Screen": { + "Width": inWidthPXInt, # Width of the remote desktop in pixels, example 1680 + "Height": inHeightPXInt, # Height of the remote desktop in pixels, example 1050 + # "640x480" or "1680x1050" or "FullScreen". If Resolution not exists set full screen, example + "FlagUseAllMonitors": inUseBothMonitorBool, # True or False, example False + "DepthBit": str(inDepthBitInt) # "32" or "24" or "16" or "15", example "32" + }, + "SharedDriveList": inSharedDriveList, # List of the Root sesion hard drives, example ["c"] + ###### Will updated in program ############ + "SessionHex": "77777sdfsdf77777dsfdfsf77777777", # Hex is created when robot runs, example "" + "SessionIsWindowExistBool": False, + # Flag if the RDP window is exist, old name "FlagSessionIsActive". Check every n seconds , example False + "SessionIsWindowResponsibleBool": False, + # Flag if RDP window is responsible (recieve commands). Check every nn seconds. If window is Responsible - window is Exist too , example False + "SessionIsIgnoredBool": False # Flag to ignore RDP window False - dont ignore, True - ignore, example False + } + """ if inSharedDriveList is None: inSharedDriveList = ["c"] lRDPTemplateDict= { # Init the configuration item @@ -1006,7 +1085,7 @@ def RDPTemplateCreate(inLoginStr, inPasswordStr, inHostStr="127.0.0.1", inPortIn # Return list if dublicates def RDPSessionDublicatesResolve(inGSettings): """ - Search dublicates in GSettings RDPlist + DEVELOPING Search dublicates in GSettings RDPlist !def is developing! :param inGSettings: Global settings dict (singleton) diff --git a/Sources/pyOpenRPA/Robot/UIDesktop.py b/Sources/pyOpenRPA/Robot/UIDesktop.py index 55c3042e..f82cc34b 100644 --- a/Sources/pyOpenRPA/Robot/UIDesktop.py +++ b/Sources/pyOpenRPA/Robot/UIDesktop.py @@ -240,6 +240,14 @@ def UIOSelector_Get_UIOList (inSpecificationList,inElement=None,inFlagRaiseExcep #inFlagRaiseException - Флаг True - выкинуть ошибку в случае обнаружении пустого списка #old name - PywinautoExtElementGet def UIOSelector_Get_UIO (inSpecificationList,inElement=None,inFlagRaiseException=True): + ''' + Get the pywinauto object by the UIO selector. + + :param inSpecificationList: + :param inElement: + :param inFlagRaiseException: + :return: + ''' lResult=None #Получить родительский объект если на вход ничего не поступило lResultList=UIOSelector_Get_UIOList(inSpecificationList,inElement,False) @@ -255,6 +263,12 @@ def UIOSelector_Get_UIO (inSpecificationList,inElement=None,inFlagRaiseException #UIOSelector #old name - - def UIOSelector_Exist_Bool (inUIOSelector): + ''' + Check if object is exist by the UIO selector. + + :param inUIOSelector: + :return: True - Object is exist. False - else case + ''' lResult=False #Check the bitness lSafeOtherProcess = UIOSelector_SafeOtherGet_Process(inUIOSelector) @@ -288,6 +302,18 @@ def UIOSelector_Exist_Bool (inUIOSelector): #####Внимание##### ##Функция ожидания появления элементов (тк элементы могут быть недоступны, неизвестно в каком фреймворке каждый из них может появиться) def UIOSelectorsSecs_WaitAppear_List (inSpecificationListList,inWaitSecs,inFlagWaitAllInMoment=False): + ''' + Wait for many UI object will appear in GUI for inWaitSecs seconds. + + :param inSpecificationListList: UIOSelector list. + Example: [ + [{"title":"notepad"},{"title":"OK"}], + [{"title":"notepad"},{"title":"Cancel"}] + ] + :param inWaitSecs: Float value (seconds) for wait UI element appear in GUI + :param inFlagWaitAllInMoment: True - Wait all UI objects from the UIOSelector list to be appeared + :return: List of index, which UI object UIO will be appeared. Example: [1] # Appear only UI object with UIO selector: [{"title":"notepad"},{"title":"Cancel"}] + ''' lResultFlag=False lSecsSleep = 1 #Настроечный параметр lSecsDone = 0 @@ -327,6 +353,19 @@ def UIOSelectorsSecs_WaitAppear_List (inSpecificationListList,inWaitSecs,inFlagW #####Внимание##### ##Функция ожидания пропажи элементов (тк элементы могут быть недоступны, неизвестно в каком фреймворке каждый из них может появиться) def UIOSelectorsSecs_WaitDisappear_List (inSpecificationListList,inWaitSecs,inFlagWaitAllInMoment=False): + ''' + Wait for many UI object will disappear in GUI for inWaitSecs seconds. + + :param inSpecificationListList: UIOSelector list. + Example: [ + [{"title":"notepad"},{"title":"OK"}], + [{"title":"notepad"},{"title":"Cancel"}] + ] + :param inWaitSecs: Float value (seconds) for wait UI element disappear in GUI + :param inFlagWaitAllInMoment: True - Wait all UI objects from the UIOSelector list to be disappeared. + :return: List of index, which UI object UIO will be disappeared. Example: [1] # Disappear only UI object with UIO selector: [{"title":"notepad"},{"title":"Cancel"}] + :return: + ''' lResultFlag=False lSecsSleep = 1 #Настроечный параметр lSecsDone = 0 @@ -363,6 +402,13 @@ def UIOSelectorsSecs_WaitDisappear_List (inSpecificationListList,inWaitSecs,inFl #return: Bool - True - UIO is appear #old name - - def UIOSelectorSecs_WaitAppear_Bool (inSpecificationList,inWaitSecs): + ''' + Wait for UI object will appear in GUI for inWaitSecs seconds. + + :param inSpecificationList: UIOSelector. Example: [{"title":"notepad"},{"title":"OK"}] + :param inWaitSecs: Float value (seconds) for wait UI element appear in GUI + :return: True - UI object will appear. False - else case + ''' lWaitAppearList=UIOSelectorsSecs_WaitAppear_List([inSpecificationList],inWaitSecs) lResult=False if len(lWaitAppearList)>0: @@ -375,6 +421,14 @@ def UIOSelectorSecs_WaitAppear_Bool (inSpecificationList,inWaitSecs): #return: Bool - True - UIO is Disappear #old name - - def UIOSelectorSecs_WaitDisappear_Bool (inSpecificationList,inWaitSecs): + ''' + Wait for UI object will disappear in GUI for inWaitSecs seconds. + + :param inSpecificationList: UIOSelector. + Example: [{"title":"notepad"},{"title":"OK"}] + :param inWaitSecs: Float value (seconds) for wait UI element disappear in GUI + :return: True - UI object will disappear. False - else case + ''' lWaitDisappearList=UIOSelectorsSecs_WaitDisappear_List([inSpecificationList],inWaitSecs) lResult=False if len(lWaitDisappearList)>0: @@ -386,6 +440,12 @@ def UIOSelectorSecs_WaitDisappear_Bool (inSpecificationList,inWaitSecs): #old name - None #return None (if Process not found), int 32, or int 64 def UIOSelector_Get_BitnessInt (inSpecificationList): + ''' + Detect process bitness by the UI Object UIO Selector. + + :param inSpecificationList: UIOSelector. Example: [{"title":"notepad"},{"title":"OK"}] + :return: int 32 or int 64 + ''' lResult=None #Получить объект Application (Для проверки разрядности) lRootElement=PWASpecification_Get_PWAApplication(inSpecificationList) @@ -401,6 +461,12 @@ def UIOSelector_Get_BitnessInt (inSpecificationList): #old name - None #return None (if Process not found), int 32, or int 64 def UIOSelector_Get_BitnessStr (inSpecificationList): + ''' + Detect process bitness by the UI Object UIO Selector. + + :param inSpecificationList: UIOSelector. Example: [{"title":"notepad"},{"title":"OK"}] + :return: str "32" or str "64" + ''' lResult=None #Получить объект Application (Для проверки разрядности) lRootElement=PWASpecification_Get_PWAApplication(inSpecificationList) @@ -415,15 +481,23 @@ def UIOSelector_Get_BitnessStr (inSpecificationList): #old name - None #return int 32, or int 64 def Get_OSBitnessInt (): - lResult=32; + ''' + Detect OS bitness. + + :return: int 32 or int 64 + ''' + lResult=32 if pywinauto.sysinfo.is_x64_OS(): - lResult=64; - return lResult; + lResult=64 + return lResult ################################################################################################# -#Safe get other process or None if destination app is the other/same bitness -#inUIOSelector - selector of the destination -#return None or process (of the other bitness) def UIOSelector_SafeOtherGet_Process(inUIOSelector): + ''' + Safe get other process or None if destination app is the other/same bitness + + :param inUIOSelector: UIO Selector of the UI object + :return: None or process (of the other bitness) + ''' #Default value lResult = None #Go check bitness if selector exists @@ -434,11 +508,14 @@ def UIOSelector_SafeOtherGet_Process(inUIOSelector): lResult = Utils.ProcessBitness.OtherProcessGet() return lResult ################################################################################################## -#inControlSpecificationArray - List of dict, dict in pywinauto.find_windows notation -#Backend selection - attribute "backend" ("win32" || "uia") in 1-st list element -#return list of UIO object -#old name - GetControl def PWASpecification_Get_UIO(inControlSpecificationArray): + ''' + #Backend def selection - attribute "backend" ("win32" || "uia") in 1-st list element + #old name - GetControl + + :param inControlSpecificationArray: List of dict, dict in pywinauto.find_windows notation + :return: list of UIO object + ''' #Определение backend lBackend=mDefaultPywinautoBackend if "backend" in inControlSpecificationArray[0]: @@ -448,7 +525,7 @@ def PWASpecification_Get_UIO(inControlSpecificationArray): inControlSpecificationOriginArray=copy.deepcopy(inControlSpecificationArray) inControlSpecificationArray=UIOSelector_SearchProcessNormalize_UIOSelector(inControlSpecificationArray) #Выполнить идентификацию объектов, если передан массив - lResultList=[]; + lResultList=[] lTempObject=None if len(inControlSpecificationArray) > 0: #Сформировать выборку элементов, которые подходят под первый уровень спецификации @@ -485,11 +562,13 @@ def PWASpecification_Get_UIO(inControlSpecificationArray): lResultList.append(lTempObject) return lResultList ################################################################################################## -#inControlSpecificationArray - List of dict, dict in pywinauto.find_windows notation -#Backend selection - attribute "backend" ("win32" || "uia") in 1-st list element -#return process application object -#old name - None def PWASpecification_Get_PWAApplication(inControlSpecificationArray): + ''' + #Backend selection - attribute "backend" ("win32" || "uia") in 1-st list element + + :param inControlSpecificationArray: List of dict, dict in pywinauto.find_windows notation + :return: process application object + ''' inControlSpecificationArray=copy.deepcopy(inControlSpecificationArray) #Определение backend lBackend=mDefaultPywinautoBackend @@ -500,7 +579,7 @@ def PWASpecification_Get_PWAApplication(inControlSpecificationArray): inControlSpecificationOriginArray=inControlSpecificationArray inControlSpecificationArray=UIOSelector_SearchProcessNormalize_UIOSelector(inControlSpecificationArray) #Выполнить идентификацию объектов, если передан массив - lResultList=[]; + lResultList=[] lTempObject=None if len(inControlSpecificationArray) > 0: #Выполнить подключение к объекту @@ -521,10 +600,14 @@ def PWASpecification_Get_PWAApplication(inControlSpecificationArray): return lTempObject ########################################################################################################### -#inElementSpecificationList = UIOSelector (see description on the top of the document) -#result = pywinauto element wrapper instance or None -#old name - AutomationSearchMouseElement def UIOSelector_SearchChildByMouse_UIO(inElementSpecification): + ''' + UIOSelector (see description on the top of the document) + #old name - AutomationSearchMouseElement + + :param inElementSpecification: UIOSelector of the UI Object + :return: pywinauto element wrapper instance or None + ''' lGUISearchElementSelected=None #Настройка - частота обновления подсвечивания lTimeSleepSeconds=0.4 @@ -556,17 +639,21 @@ def UIOSelector_SearchChildByMouse_UIO(inElementSpecification): UIO_Highlight(lElementFounded) else: #Была нажата клавиша Ctrl - выйти из цикла - lFlagLoop=False; + lFlagLoop=False #Заснуть до следующего цикла time.sleep(lTimeSleepSeconds) #Вернуть результат поиска return lElementFoundedList #################################################################################################### -#inElementSpecification - UIOSelector -#!!!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!! #old name - AutomationSearchMouseElementHierarchy def UIOSelector_SearchChildByMouse_UIOTree(inUIOSelector): + ''' + !!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!! + + :param inUIOSelector: UIOSelector of the UI Object + :return: ? + ''' lItemInfo = [] #Check the bitness lSafeOtherProcess = UIOSelector_SafeOtherGet_Process(inUIOSelector) @@ -750,7 +837,9 @@ def UIOSelector_Get_UIOActivityList (inUIOSelector): #inUIOSelector #inActionName - UIOActivity (name) from Pywinauto #old name - ElementRunAction -def UIOSelectorUIOActivity_Run_Dict(inUIOSelector, inActionName, inArgumentList=[], inkwArgumentObject={}): +def UIOSelectorUIOActivity_Run_Dict(inUIOSelector, inActionName, inArgumentList=None, inkwArgumentObject=None): + if inArgumentList is None: inArgumentList=[] # 2021 02 22 Minor fix by Ivan Maslov + if inkwArgumentObject is None: inkwArgumentObject={} # 2021 02 22 Minor fix by Ivan Maslov lResult={} #Check the bitness lSafeOtherProcess = UIOSelector_SafeOtherGet_Process(inUIOSelector) @@ -804,7 +893,7 @@ def UIOSelector_Get_UIOInfo(inUIOSelector): #Подготовка входного массива inUIOSelector=UIOSelector_SearchUIONormalize_UIOSelector(inUIOSelector) #Выполнить идентификацию объектов, если передан массив - lResultList=[]; + lResultList=[] if len(inUIOSelector) > 0: #Получить объект lTempObject=UIOSelector_Get_UIO(inUIOSelector) @@ -832,7 +921,8 @@ def UIOSelector_Get_UIOInfo(inUIOSelector): #inHierarchyList: [{"index":<>,"element":<>}] - technical argument for internal purpose #result -List of dict [{"index":<>,"element":<>}] -- list of element hierarchy specifications #old name - GUISearchElementByRootXY -def UIOXY_SearchChild_ListDict(inRootElement,inX,inY,inHierarchyList=[]): +def UIOXY_SearchChild_ListDict(inRootElement,inX,inY,inHierarchyList=None): + if inHierarchyList is None: inHierarchyList = [] #Инициализация результирующего значения lResultElement = None lResultElementX1 = None @@ -921,7 +1011,8 @@ def UIOXY_SearchChild_ListDict(inRootElement,inX,inY,inHierarchyList=[]): #!!!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!! #inControlSpecificationArray- UIOSelector #old name - ElementGetChildElementList -def UIOSelector_GetChildList_UIOList(inUIOSelector=[], inBackend=mDefaultPywinautoBackend): +def UIOSelector_GetChildList_UIOList(inUIOSelector=None, inBackend=mDefaultPywinautoBackend): + if inUIOSelector is None: inUIOSelector = [] #mRobotLogger.info(f"File!!!!") #mRobotLogger.info(f"inSelector:{str(inUIOSelector)}, inBackend:{str(inBackend)}") #pdb.set_trace() @@ -1202,7 +1293,7 @@ def BackendStr_GetTopLevelList_UIOInfo(inBackend=mDefaultPywinautoBackend): lResultList2=[] for lI in lResultList: lTempObjectInfo=lI - lResultList2.append(UIOEI_Convert_UIOInfo(lI)); + lResultList2.append(UIOEI_Convert_UIOInfo(lI)) return lResultList2 ################################################################################################### diff --git a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html index 1b270b56..c719e41a 100644 --- a/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html +++ b/Wiki/ENG_Guide/html/Orchestrator/02_Defs.html @@ -194,7 +194,7 @@
Add activity in AgentDict.
AgentOSCMD
(inGSettings, inHostNameStr, …)
pyOpenRPA.Agent: Send CMD to OS.
Send CMD to OS throught the pyOpenRPA.Agent daemon.
pyOpenRPA.Agent: Create binary file by the base64 string (safe for JSON transmission) def OSFileBinaryDataBase64StrCreate(inFilePathStr, inFileDataBase64Str,inGSettings = None): Send binary file to Agent (base64 string)
Check if there is any running process that contains the given name processName.
ProcessListGet
([inProcessNameWOExeList])
Return process list on the orchestrator machine.
Return process list on the orchestrator machine sorted by Memory Usage.
ProcessStart
(inPathStr, inArgList[, …])
Start process locally.
Update alias for def (can be used in ActivityItem in field Def).
PythonStart
(inModulePathStr, inDefNameStr[, …])
Python import module and start def
Import module and run def in the Orchestrator process.
RDPSessionCMDRun
(inGSettings, …[, inModeStr])
Send command in RDP session
Disconnect the RDP session
RDPSessionDublicatesResolve
(inGSettings)
Search dublicates in GSettings RDPlist !def is developing!
DEVELOPING Search dublicates in GSettings RDPlist !def is developing!
RDPSessionFileStoredRecieve
(inGSettings, …)
Receive file from Session RDP to Host using shared drive in RDP
Check RDP Session responsibility TODO NEED DEV + TEST
RDPTemplateCreate
(inLoginStr, inPasswordStr)
Create some RDP template dict to use it when connect/reconnect
Create RDP connect dict item/ Use it connect/reconnect (Orchestrator.RDPSessionConnect)
SchedulerActivityTimeAddWeekly
(inGSettings)
Add activity in time weekly
Add activity item list in scheduler.
UACKeyListCheck
(inRequest, inRoleKeyList)
Check is client is has access for the key list
pyOpenRPA.Orchestrator.__Orchestrator__.
AgentOSCMD
(inGSettings, inHostNameStr, inUserStr, inCMDStr, inRunAsyncBool=True)[source]¶pyOpenRPA.Agent: Send CMD to OS. Result return to log + Orchestrator by the A2O connection +
Send CMD to OS throught the pyOpenRPA.Agent daemon. Result return to log + Orchestrator by the A2O connection def OSCMD(inCMDStr, inRunAsyncBool=True, inGSettings=None): Send to agent activity item to OSCMD
pyOpenRPA.Orchestrator.__Orchestrator__.
ProcessListGet
(inProcessNameWOExeList=None)[source]¶Return process list on the orchestrator machine. You can determine the list of the processes you are interested - def will return the list about it.
+Return process list on the orchestrator machine sorted by Memory Usage. You can determine the list of the processes you are interested - def will return the list about it.
# USAGE
from pyOpenRPA import Orchestrator
lProcessList = Orchestrator.ProcessListGet()
-# Return the list of the process on the machine. !ATTENTION! RUn orchestrator as administrator to get all process list on the machine.
+# Return the list of the process on the machine.
+# !ATTENTION! RUn orchestrator as administrator to get all process list on the machine.
pyOpenRPA.Orchestrator.__Orchestrator__.
PythonStart
(inModulePathStr, inDefNameStr, inArgList=None, inArgDict=None, inLogger=None)[source]¶Python import module and start def
+Import module and run def in the Orchestrator process.
+Note
+Import module will be each time when PythonStart def will be called.
+# USAGE
+from pyOpenRPA import Orchestrator
+
+Orchestrator.PythonStart(
+ inModulePathStr="ModuleToCall.py", # inModulePathStr: Working Directory\ModuleToCall.py
+ inDefNameStr="TestDef")
+# Import module in Orchestrator process and call def "TestDef" from module "ModuleToCall.py"
+
inModulePathStr –
inDefNameStr –
inArgList –
inArgDict –
inLogger –
inModulePathStr – Absolute or relative (working directory of the orchestrator process) path to the importing module .py
inDefNameStr – Def name in module
inArgList – List of the arguments for callable def
inArgDict – Dict of the named arguments for callable def
inLogger – Logger instance to log some information when PythonStart def is running
None
pyOpenRPA.Orchestrator.__Orchestrator__.
RDPSessionDublicatesResolve
(inGSettings)[source]¶Search dublicates in GSettings RDPlist +
DEVELOPING Search dublicates in GSettings RDPlist !def is developing!
pyOpenRPA.Orchestrator.__Orchestrator__.
RDPTemplateCreate
(inLoginStr, inPasswordStr, inHostStr='127.0.0.1', inPortInt=3389, inWidthPXInt=1680, inHeightPXInt=1050, inUseBothMonitorBool=False, inDepthBitInt=32, inSharedDriveList=None)[source]¶Create some RDP template dict to use it when connect/reconnect
+Create RDP connect dict item/ Use it connect/reconnect (Orchestrator.RDPSessionConnect)
+# USAGE
+from pyOpenRPA import Orchestrator
+
+lRDPItemDict = Orchestrator.RDPTemplateCreate(
+ inLoginStr = "USER_99",
+ inPasswordStr = "USER_PASS_HERE",
+ inHostStr="127.0.0.1",
+ inPortInt = 3389,
+ inWidthPXInt = 1680,
+ inHeightPXInt = 1050,
+ inUseBothMonitorBool = False,
+ inDepthBitInt = 32,
+ inSharedDriveList=None)
+# lRDPTemplateDict= { # Init the configuration item
+# "Host": "127.0.0.1", "Port": "3389", "Login": "USER_99", "Password": "USER_PASS_HERE",
+# "Screen": { "Width": 1680, "Height": 1050, "FlagUseAllMonitors": False, "DepthBit": "32" },
+# "SharedDriveList": ["c"],
+# ###### Will updated in program ############
+# "SessionHex": "77777sdfsdf77777dsfdfsf77777777", # Hex is created when robot runs, example ""
+# "SessionIsWindowExistBool": False, "SessionIsWindowResponsibleBool": False, "SessionIsIgnoredBool": False
+# }
+
inLoginStr –
inPasswordStr –
inHostStr –
inPortInt –
inWidthPXInt –
inHeightPXInt –
inUseBothMonitorBool –
inDepthBitInt –
inSharedDriveList –
inLoginStr – User/Robot Login, example “USER_99”
inPasswordStr – Password, example “USER_PASS_HERE”
inHostStr – Host address, example “77.77.22.22”
inPortInt – RDP Port, example “3389” (default)
inWidthPXInt – Width of the remote desktop in pixels, example 1680
inHeightPXInt – Height of the remote desktop in pixels, example 1050
inUseBothMonitorBool – True - connect to the RDP with both monitors. False - else case
inDepthBitInt – Remote desktop bitness. Available: 32 or 24 or 16 or 15, example 32
inSharedDriveList – Host local disc to connect to the RDP session. Example: [“c”, “d”]
“Host”: inHostStr, # Host address, example “77.77.22.22” +“Port”: str(inPortInt), # RDP Port, example “3389” +“Login”: inLoginStr, # Login, example “test” +“Password”: inPasswordStr, # Password, example “test” +“Screen”: {
+++”Width”: inWidthPXInt, # Width of the remote desktop in pixels, example 1680 +“Height”: inHeightPXInt, # Height of the remote desktop in pixels, example 1050 +# “640x480” or “1680x1050” or “FullScreen”. If Resolution not exists set full screen, example +“FlagUseAllMonitors”: inUseBothMonitorBool, # True or False, example False +“DepthBit”: str(inDepthBitInt) # “32” or “24” or “16” or “15”, example “32”
+
}, +“SharedDriveList”: inSharedDriveList, # List of the Root sesion hard drives, example [“c”] +###### Will updated in program ############ +“SessionHex”: “77777sdfsdf77777dsfdfsf77777777”, # Hex is created when robot runs, example “” +“SessionIsWindowExistBool”: False, +# Flag if the RDP window is exist, old name “FlagSessionIsActive”. Check every n seconds , example False +“SessionIsWindowResponsibleBool”: False, +# Flag if RDP window is responsible (recieve commands). Check every nn seconds. If window is Responsible - window is Exist too , example False +“SessionIsIgnoredBool”: False # Flag to ignore RDP window False - dont ignore, True - ignore, example False
+}
+pyOpenRPA.Orchestrator.__Orchestrator__.
SchedulerActivityTimeAddWeekly
(inGSettings, inTimeHHMMStr='23:55:', inWeekdayList=None, inActivityList=None)[source]¶Add activity in time weekly
+Add activity item list in scheduler. You can set weekday list and set time when launch. Activity list will be executed at planned time/day.
+# USAGE
+from pyOpenRPA import Orchestrator
+
+# EXAMPLE 1
+def TestDef(inArg1Str):
+ pass
+lActivityItem = Orchestrator.ProcessorActivityItemCreate(
+ inDef = TestDef,
+ inArgList=[],
+ inArgDict={"inArg1Str": "ArgValueStr"},
+ inArgGSettingsStr = None,
+ inArgLoggerStr = None)
+Orchestrator.SchedulerActivityTimeAddWeekly(
+ inGSettings = gSettingsDict,
+ inTimeHHMMStr = "04:34",
+ inWeekdayList=[2,3,4],
+ inActivityList = [lActivityItem])
+# Activity will be executed at 04:34 Wednesday (2), thursday (3), friday (4)
+
inGSettings – Global settings dict (singleton)
inTimeHHMMStr –
inWeekdayList –
inActivityList –
inTimeHHMMStr – Activation time from “00:00” to “23:59”. Example: “05:29”
inWeekdayList – Week day list to initiate activity list. Use int from 0 (monday) to 6 (sunday) as list items. Example: [0,1,2,3,4]. Default value is everyday ([0,1,2,3,4,5,6])
inActivityList – Activity list structure
None
pyOpenRPA Robot is the python package.
pyOpenRPA.Robot.UIDesktop.
Get_OSBitnessInt
()[source]¶Detect OS bitness.
+int 32 or int 64
+pyOpenRPA.Robot.UIDesktop.
PWASpecification_Get_PWAApplication
(inControlSpecificationArray)[source]¶#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)[source]¶#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)[source]¶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)[source]¶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.
UIOSelector_Exist_Bool
(inUIOSelector)[source]¶Check if object is exist by the UIO selector.
+inUIOSelector –
+True - Object is exist. False - else case
+pyOpenRPA.Robot.UIDesktop.
UIOSelector_Get_BitnessInt
(inSpecificationList)[source]¶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)[source]¶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)[source]¶Get the pywinauto object by the UIO selector.
+inSpecificationList –
inElement –
inFlagRaiseException –
pyOpenRPA.Robot.UIDesktop.
UIOSelector_Get_UIOList
(inSpecificationList, inElement=None, inFlagRaiseException=True)[source]¶pyOpenRPA.Robot.UIDesktop.
UIOSelector_SafeOtherGet_Process
(inUIOSelector)[source]¶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)[source]¶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)[source]¶!!!!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.
UIOSelectorsSecs_WaitAppear_List
(inSpecificationListList, inWaitSecs, inFlagWaitAllInMoment=False)[source]¶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)[source]¶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”}]
+UIOSelector_Get_UIOList
(inSpecificationList)
Detect OS bitness.
#Backend selection - attribute “backend” (“win32” || “uia”) in 1-st list element
#Backend def selection - attribute “backend” (“win32” || “uia”) in 1-st list element #old name - GetControl
Wait for UI object will appear in GUI for inWaitSecs seconds.
Wait for UI object will disappear in GUI for inWaitSecs seconds.
UIOSelector_Exist_Bool
(inUIOSelector)
Check if object is exist by the UIO selector.
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_UIOList
(inSpecificationList)
Get the UIO list by the selector
UIOSelector_SafeOtherGet_Process
(inUIOSelector)
Safe get other process or None if destination app is the other/same bitness
UIOSelector (see description on the top of the document) #old name - AutomationSearchMouseElement
!!!!Safe call is included (you can set activity and UIDesktop will choose the bitness and return the result)!!!!!
UIOSelectorsSecs_WaitAppear_List
(…[, …])
Wait for many UI object will appear in GUI for inWaitSecs seconds.
Wait for many UI object will disappear in GUI for inWaitSecs seconds.
pyOpenRPA.Robot.UIDesktop.
Get_OSBitnessInt
()[source]¶Detect OS bitness.
+int 32 or int 64
+pyOpenRPA.Robot.UIDesktop.
PWASpecification_Get_PWAApplication
(inControlSpecificationArray)[source]¶#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)[source]¶#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)[source]¶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)[source]¶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.
UIOSelector_Exist_Bool
(inUIOSelector)[source]¶Check if object is exist by the UIO selector.
+inUIOSelector –
+True - Object is exist. False - else case
+pyOpenRPA.Robot.UIDesktop.
UIOSelector_Get_BitnessInt
(inSpecificationList)[source]¶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)[source]¶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)[source]¶Get the pywinauto object by the UIO selector.
+inSpecificationList –
inElement –
inFlagRaiseException –
pyOpenRPA.Robot.UIDesktop.
UIOSelector_Get_UIOList
(inSpecificationList, inElement=None, inFlagRaiseException=True)[source]¶pyOpenRPA.Robot.UIDesktop.
UIOSelector_SafeOtherGet_Process
(inUIOSelector)[source]¶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)[source]¶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)[source]¶!!!!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.
UIOSelectorsSecs_WaitAppear_List
(inSpecificationListList, inWaitSecs, inFlagWaitAllInMoment=False)[source]¶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)[source]¶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”}]
+