# 使用快捷键 <alt + w>显示或者隐藏微信窗口,如果微信没有运行,则进行运行
import uiautomation as auto
import time
import subprocess
from threading import Event
# 隐式等待
auto.uiautomation.TIME_OUT_SECOND = 0.1 # global time out
def launch_wechat(stopEvent: Event):
'''
显示隐藏微信窗口
'''
className = 'WeChatMainWndForPC'
ForegroundControl = auto.GetForegroundControl().GetTopLevelControl()
print('当前窗口控件信息:', ForegroundControl)
global handle
appPath = r'C:\Program Files (x86)\Tencent\WeChat\WeChat.exe'
print('当前窗口的类名是', ForegroundControl.ClassName, '微信的类名是:', className)
基于uiautomation 实现快捷键显示或者隐藏微信窗口
最新推荐文章于 2024-05-03 02:01:17 发布