From 9e2efe7e1b301036839feb12ccfbb8c11bf5f96a Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sat, 20 Feb 2021 09:18:48 +0300 Subject: [PATCH] Orchestrator.RDPSessionCMDRun - Fix return + some help comments --- .../Orchestrator/RobotRDPActive/Connector.py | 1 + .../Orchestrator/__Orchestrator__.py | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py b/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py index a5d434e8..2f827f24 100644 --- a/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py +++ b/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py @@ -245,6 +245,7 @@ def SessionCMDRun(inSessionHex,inCMDCommandStr = "echo 1", inModeStr="CROSSCHECK # Exit fullscreen mode SessionScreenSize_X_Y_W_H(inSessionHex=inSessionHex, inXInt=10, inYInt=10, inWInt=550, inHInt=350) # Prepare little window + return lResult # Check if session is in Full screen mode # Return True - is in fullscreen # example print(Connector.SessionIsFullScreen("")) diff --git a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py index 68c4d1f4..1e89a1c5 100644 --- a/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py +++ b/Sources/pyOpenRPA/Orchestrator/__Orchestrator__.py @@ -1041,27 +1041,38 @@ def RDPSessionCMDRun(inGSettings, inRDPSessionKeyStr, inCMDStr, inModeStr="CROSS :param inGSettings: Global settings dict (singleton) :param inRDPSessionKeyStr: :param inCMDStr: - :param inModeStr: - :return: True - CMD was executed successfully + :param inModeStr: Variants: + "LISTEN" - Get result of the cmd command in result; + "CROSSCHECK" - Check if the command was successufully sent + "RUN" - Run without crosscheck and get clipboard + :return: # OLD > True - CMD was executed successfully + { + "OutStr": <> # Result string + "IsResponsibleBool": True|False # Flag is RDP is responsible - works only when inModeStr = CROSSCHECK + } """ + lResult = { + "OutStr": None, # Result string + "IsResponsibleBool": False # Flag is RDP is responsible - works only when inModeStr = CROSSCHECK + } # Check thread if not Core.IsProcessorThread(inGSettings=inGSettings): if inGSettings["Logger"]: inGSettings["Logger"].warning(f"RDP def was called not from processor queue - activity will be append in the processor queue.") - lResult = { + lProcessorActivityDict = { "Def": RDPSessionCMDRun, # def link or def alias (look gSettings["Processor"]["AliasDefDict"]) "ArgList": [], # Args list "ArgDict": {"inRDPSessionKeyStr": inRDPSessionKeyStr, "inCMDStr": inCMDStr, "inModeStr": inModeStr }, # Args dictionary "ArgGSettings": "inGSettings", # Name of GSettings attribute: str (ArgDict) or index (for ArgList) "ArgLogger": None # Name of GSettings attribute: str (ArgDict) or index (for ArgList) } - inGSettings["ProcessorDict"]["ActivityList"].append(lResult) + inGSettings["ProcessorDict"]["ActivityList"].append(lProcessorActivityDict) else: - lResult = True + #lResult = True # Calculate the session Hex lSessionHex = inGSettings["RobotRDPActive"]["RDPList"].get(inRDPSessionKeyStr,{}).get("SessionHex", None) # Run CMD if lSessionHex: - Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=inCMDStr, inModeStr=inModeStr, inLogger=inGSettings["Logger"], + lResult = Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=inCMDStr, inModeStr=inModeStr, inLogger=inGSettings["Logger"], inRDPConfigurationItem=inGSettings["RobotRDPActive"]["RDPList"][inRDPSessionKeyStr]) return lResult