# Fix in CMDRun for some OS # Fix in async set in clipboard # Fix double ctrl a for some os cmd (wrong actions)

dev-linux
Ivan Maslov 4 years ago
parent cd038a0879
commit e1bd95c4cc

@ -311,16 +311,32 @@ def SystemCMDRun(inSessionHexStr, inCMDCommandStr = "echo 1", inModeStr="CROSSCH
while lRecoveryWindowRUNRetryIteratorInt<gRecoveryWindowRUNRetryCountInt: # loop for retry
lCMDPostFixStr = "" # Case default "RUN"
if inModeStr == "CROSSCHECK":
lCMDPostFixStr = f"& (echo {lCrosscheckKeyStr} | clip)"
#lCMDPostFixStr = f"& (echo {lCrosscheckKeyStr} | clip)"
lCMDPostFixStr = f"| (echo {lCrosscheckKeyStr} | clip)" # Bugfix async set clipboard data
elif inModeStr == "LISTEN":
lCMDPostFixStr = f"| clip"
Clipboard.TextSet("") # Clear the clipboard
KeyboardHotkey("win","r") # win+r
time.sleep(gKeyboardHotkeyDelaySecFloat)
KeyboardHotkey("ctrl","a") # Select all
KeyboardHotkey("ctrl","a") # Select all Bugfix - need double ctrl A because some OS reset selestion when ctrl A in RUN window
#time.sleep(gKeyboardHotkeyDelaySecFloat)
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)
# Check if autocomplete
# # # # # # #
KeyboardHotkey("ctrl", "c") # Copy data
# Check the clipboard
lClipboardStr = Clipboard.TextGet() # Get text from clipboard
time.sleep(gKeyboardHotkeyDelaySecFloat)
#lL.debug(f"Clipboard text when check autocomplete:'{lClipboardStr}'")
if lClipboardStr != "": # Send backspace if
time.sleep(gKeyboardHotkeyDelaySecFloat)
keyboard.send("backspace") # Delete selected all
# # # # # # # #
KeyboardHotkey("ctrl","a") # Select all
KeyboardHotkey("ctrl","c") # Copy data
# Check the clipboard

@ -115,8 +115,23 @@ def RDPSessionProcessStartIfNotRunning(inRDPSessionKeyStr, inProcessNameWEXEStr,
lSessionHex = inGlobalDict["RobotRDPActive"]["RDPList"].get(inRDPSessionKeyStr,{}).get("SessionHex", None)
# Run CMD
if lSessionHex:
Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=lCMDStr, inModeStr="CROSSCHECK", inLogger=gSettings["Logger"], inRDPConfigurationItem=gSettings["RobotRDPActive"]["RDPList"][inRDPSessionKeyStr])
Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=lCMDStr, inModeStr="CROSSCHECK", inLogger=gSettings["Logger"],
inRDPConfigurationItem=gSettings["RobotRDPActive"]["RDPList"][inRDPSessionKeyStr])
return lResult
def RDPSessionCMDRun(inRDPSessionKeyStr, inCMDStr, inModeStr="CROSSCHECK"):
global gSettings
inGlobalDict = gSettings
lResult = True
# Calculate the session Hex
lSessionHex = inGlobalDict["RobotRDPActive"]["RDPList"].get(inRDPSessionKeyStr,{}).get("SessionHex", None)
# Run CMD
if lSessionHex:
Connector.SessionCMDRun(inSessionHex=lSessionHex, inCMDCommandStr=inCMDStr, inModeStr=inModeStr, inLogger=gSettings["Logger"],
inRDPConfigurationItem=gSettings["RobotRDPActive"]["RDPList"][inRDPSessionKeyStr])
return lResult
# Create CMD str to stop process
def RDPSessionProcessStop(inRDPSessionKeyStr, inProcessNameWEXEStr, inFlagForceCloseBool):
global gSettings

Loading…
Cancel
Save