# Keyboar - hotkey fix with rdp - need UAT

dev-linux
Ivan Maslov 5 years ago
parent 7ca1c2b6b3
commit be364e5e42

@ -21,6 +21,8 @@ gRecoveryWindowRUNRetryIntervalSecInt = 3 # Retry interval for retry
gRecoveryCMDResponsibleRetryCountInt = 3 # Retry iteration count is CMD is not responsible
gRecoveryCMDResponsibleRetryIntervalSecInt = 3 # Retry interval for retry
gKeyboardHotkeyDelaySecFloat = 0.6 # Const for delay - important for work with RDP!!!!
#Connect to RDP session
"""
{
@ -312,16 +314,15 @@ def SystemCMDRun(inSessionHexStr, inCMDCommandStr = "echo 1", inModeStr="CROSSCH
lCMDPostFixStr = f"& (echo {lCrosscheckKeyStr} | clip)"
elif inModeStr == "LISTEN":
lCMDPostFixStr = f"| clip"
keyboard.press_and_release('win+r')
time.sleep(1) # Wait for RUN window will appear
lRDPWindow.type_keys("^(a)") # Select all
keyboard.press_and_release("backspace") # Delete selected all
time.sleep(0.5) # Wait for RUN window will appear ctrl+a+backspace is async - so we need some timeout...
KeyboardHotkey("win","r") # win+r
KeyboardHotkey("ctrl","a") # Select all
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(0.5)
lRDPWindow.type_keys("^(a)") # Select all
lRDPWindow.type_keys("^(c)") # Copy data
time.sleep(gKeyboardHotkeyDelaySecFloat)
KeyboardHotkey("ctrl","a") # Select all
KeyboardHotkey("ctrl","c") # Copy data
# Check the clipboard
lClipboardWaitTimeStartSec = time.time()
lClipboardStr = Clipboard.TextGet() # Get text from clipboard
@ -392,4 +393,12 @@ def SystemRDPWarningClickOk():
UIDesktop.UIOSelector_Get_UIO([{"title": "Remote Desktop Connection", "class_name": "#32770", "backend": "win32"},
{"title": "OK", "class_name": "Button"}]).click()
except Exception as e:
pass
pass
# Bugfix with RDP work
def KeyboardHotkey(inModifierKeyStr,inKeyStr, inDelaySecFloat=gKeyboardHotkeyDelaySecFloat):
keyboard.press(inModifierKeyStr)
time.sleep(inDelaySecFloat)
keyboard.send(inKeyStr)
time.sleep(inDelaySecFloat)
keyboard.release(inModifierKeyStr)
time.sleep(inDelaySecFloat)
Loading…
Cancel
Save