From 51c916a0e76f5debda128285727a0883ee530837 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Tue, 2 Mar 2021 17:44:29 +0300 Subject: [PATCH] RDP.SystemCMDRun - fix if command string is more than 259 symb - not applicable for RUN window - need to open CMD and type! --- .../Orchestrator/RobotRDPActive/Connector.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py b/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py index 803fc257..85bb1099 100644 --- a/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py +++ b/Sources/pyOpenRPA/Orchestrator/RobotRDPActive/Connector.py @@ -325,8 +325,18 @@ def SystemCMDRun(inSessionHexStr, inCMDCommandStr = "echo 1", inModeStr="CROSSCH keyboard.send("backspace") # Delete selected all time.sleep(gKeyboardHotkeyDelaySecFloat) # Wait for RUN window will appear ctrl+a+backspace is async - so we need some timeout... lInputStr = f"cmd /c ({inCMDCommandStr}) {lCMDPostFixStr}" # Generate the output string for RUN window - keyboard.write(lInputStr) # Write new text - time.sleep(gKeyboardHotkeyDelaySecFloat) + if len(lInputStr) <= 259: + keyboard.write(lInputStr) # Write new text + time.sleep(gKeyboardHotkeyDelaySecFloat) + else: + if lL: lL.warning(f"RDP.SystemCMDRun: ATTENTION! Your command is too big for the RUN window (len is {len(lInputStr)}. Orchestrator will send this command to the new cmd window. ") + # Case when string is tool big - call cmd and then type text into + keyboard.write("cmd") # Open cmd + time.sleep(1) + keyboard.press_and_release('enter') # Execute CMD + keyboard.write(f"({inCMDCommandStr}) {lCMDPostFixStr}", delay= 0.05) # send command + time.sleep(1) + keyboard.press_and_release('enter') # Execute command # Check if autocomplete # # # # # # # KeyboardHotkey("ctrl", "c") # Copy data