Python脚本:1Remote_RDP_Autoreconnection (#1536)
基于1Remote软件的Rdp本地远程日志监控,并自动检测断连重启的Python脚本。需要看readme才能使用!!
This commit is contained in:
24
repo/js/autoreconnection.py
Normal file
24
repo/js/autoreconnection.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pyautogui
|
||||
import time
|
||||
|
||||
print("正在执行会话关闭后操作...")
|
||||
time.sleep(2)
|
||||
# 返回Windows桌面(Win+D)
|
||||
pyautogui.hotkey('winleft', 'd') # 更通用的Win+D组合键
|
||||
time.sleep(1) # 等待1秒
|
||||
|
||||
# 按下Alt+M键(半秒后松开)
|
||||
pyautogui.keyDown('alt') # 按住Alt键
|
||||
pyautogui.press('m') # 按M键
|
||||
time.sleep(0.5) # 精确等待0.5秒(半秒)
|
||||
pyautogui.keyUp('alt') # 松开Alt键
|
||||
pyautogui.keyUp('m') # 松开M键(确保按键无粘连)
|
||||
|
||||
time.sleep(0.1) # 等待0.1秒
|
||||
|
||||
# 按两次回车键,间隔0.3秒
|
||||
pyautogui.press('enter')
|
||||
time.sleep(0.3) # 等待0.3秒
|
||||
pyautogui.press('enter')
|
||||
|
||||
print("操作完成!")
|
||||
Reference in New Issue
Block a user