Files
bettergi-scripts-list/repo/js/autoreconnection.py
火山 939a96cf48 Python脚本:1Remote_RDP_Autoreconnection (#1536)
基于1Remote软件的Rdp本地远程日志监控,并自动检测断连重启的Python脚本。需要看readme才能使用!!
2025-08-10 16:25:01 +08:00

24 lines
699 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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("操作完成!")