
- 1 installs
- 1 repo stars
- Updated February 28, 2026
- drwanglaoshi/auto-wechat
Automate WeChat on Windows to wake the app, open a chat, and send text messages, files, or screenshots via a Python CLI using keyboard simulation.
About
Automates the Windows WeChat desktop client to send messages, files, and screenshots through a unified Python CLI. A developer uses it to integrate WeChat notifications into scripts or workflows.
- Windows-API window wake independent of image recognition
- Sends text, files, and desktop screenshots to a named chat
Wechat by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,983 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/drwanglaoshi/auto-wechat --skill wechatAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 1 |
| Last updated | February 28, 2026 |
| Repository | drwanglaoshi/auto-wechat ↗ |
What it does
Automate WeChat on Windows to wake the app, open a chat, and send text messages, files, or screenshots via a Python CLI using keyboard simulation.
Files
WeChat Automation - 微信自动化
功能
整合微信自动化核心功能,提供统一的命令行入口:
- 唤醒微信窗口
- 搜索并打开聊天窗口
- 发送文本消息
- 发送文件/图片
- 截取桌面并发送
何时使用
- 需要快速发送微信消息/文件
- 需要截图并发送到微信
- 业务脚本中需要集成微信通知功能
- 条码上传等完整流程的最后一步
使用方式
命令行调用
# 发送文本消息
python skills/wechat/scripts/main.py 文件传输助手 测试消息
# 发送文件/图片
python skills/wechat/scripts/main.py 文件传输助手 C:\path\to\image.png --file
# 不添加签名后缀
python skills/wechat/scripts/main.py 文件传输助手 测试消息 --no-signature
# 发送给指定联系人
python skills/wechat/scripts/main.py 张三 你好,最近怎么样?Python 脚本调用
import subprocess
# 发送文本消息
subprocess.run([
'python', 'skills/wechat/scripts/main.py',
'文件传输助手', '测试消息'
])
# 发送文件
subprocess.run([
'python', 'skills/wechat/scripts/main.py',
'文件传输助手', 'C:\\image.png', '--file'
])工作流程
┌─────────────────────────────────────────────────────────────┐
│ wechat/main.py │
├─────────────────────────────────────────────────────────────┤
│ 1. wake.py → 唤醒微信窗口 │
│ 2. search_chat.py → 搜索并打开聊天窗口 │
│ 3. send_message.py → 发送消息 │
│ 或 │
│ send_file.py → 发送文件 │
└─────────────────────────────────────────────────────────────┘脚本说明
scripts/main.py - 通用入口
功能: 微信自动化通用入口主脚本
执行方式:
python scripts/main.py <聊天名称> <消息内容>
python scripts/main.py <聊天名称> <文件路径> --file
python scripts/main.py <聊天名称> --screenshotscripts/wake.py - 唤醒微信
功能: 使用 Windows API 唤醒微信窗口到最前
执行方式:
python scripts/wake.py优势:
- 不依赖图像识别
- 不受窗口遮挡、多屏、DPI 影响
- 支持快捷键备用方案(Ctrl+Alt+X)
scripts/search_chat.py - 搜索聊天
功能: 使用快捷键搜索并打开指定聊天窗口
执行方式:
python scripts/search_chat.py <聊天名称>技巧: 使用 Ctrl+F 打开搜索框,剪贴板粘贴中文
scripts/send_message.py - 发送消息
功能: 在已打开的聊天窗口中发送文本消息
执行方式:
python scripts/send_message.py <消息内容>
python scripts/send_message.py <消息内容> --no-signature前提: 聊天窗口已打开,光标已聚焦到输入框
scripts/send_file.py - 发送文件
功能: 发送文件/图片到微信聊天窗口
执行方式:
python scripts/send_file.py <文件路径>
python scripts/send_file.py <文件路径> <附加消息>原理: 使用 PowerShell Set-Clipboard 复制文件到剪贴板
环境要求
| 项目 | 要求 |
|---|---|
| 操作系统 | Windows 10/11 |
| Python | 3.8+ |
| 微信 | PC 版已安装并登录 |
| 依赖库 | pyautogui, pyperclip |
输出示例
发送文本消息
============================================================
微信自动化 - 发送文本消息
============================================================
目标聊天:文件传输助手
消息内容:测试消息...
============================================================
[步骤 1/4] 唤醒微信...
[步骤 2/4] 搜索'文件传输助手'...
[步骤 3/4] 发送消息到'文件传输助手'...
[步骤 4/4] 完成
============================================================
[OK] 消息已发送到:文件传输助手
============================================================发送文件
============================================================
微信自动化 - 发送文件/图片
============================================================
目标聊天:文件传输助手
文件路径:C:\Users\Wang\.openclaw\workspace\image.png
============================================================
[步骤 1/4] 唤醒微信...
[步骤 2/4] 搜索'文件传输助手'...
[步骤 3/4] 发送文件到'文件传输助手'...
[步骤 4/4] 完成
============================================================
[OK] 文件已发送到:文件传输助手
============================================================故障排除
微信未找到
[ERROR] 未找到微信窗口(微信可能未启动)解决: 先手动启动微信客户端
文件不存在
[ERROR] 文件不存在:C:\path\to\file.png解决: 检查文件路径是否正确,使用绝对路径
消息未发送
解决: 1. 确认微信已登录 2. 确认聊天窗口已打开 3. 检查微信是否正常响应
安全说明
- 本脚本仅模拟键盘操作
- 不会读取或存储聊天内容
- 不会修改微信配置
- 所有操作在本地完成
维护指南
修改微信快捷键
当前默认快捷键: Ctrl+Alt+S
如果微信的唤醒快捷键发生变化,只需修改以下 2 个文件:
| 文件 | 位置 | 修改内容 |
|---|---|---|
scripts/wake.py | 约第 104 行 | pyautogui.hotkey('ctrl', 'alt', 's') |
scripts/search_chat.py | 约第 70、74 行 | pyautogui.hotkey('ctrl', 'alt', 's')(2 处) |
修改步骤: 1. 修改 wake.py 中的快捷键 2. 修改 search_chat.py 中的快捷键(2 处) 3. 同时更新打印提示文字(如 [步骤 3] 重置微信窗口焦点(Ctrl+Alt+S × 2)...)
快捷方式: 对 AI 说 "修改微信快捷键为 Ctrl+Alt+X",AI 会自动修改这 2 个文件。
更新日志
v2.0.0 (2026-02-28)
- ✅ 整合 4 个分散的微信技能目录为一个
- ✅ 简化脚本命名(wake.py, search_chat.py, send_message.py, send_file.py)
- ✅ 统一入口脚本(main.py)支持文本/文件发送
- ✅ 删除冗余独立脚本
v1.0.0 (2026-02-25)
- ✅ 初始版本(分散的 4 个技能目录)
---
最后更新:2026-02-28 版本:2.0.0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
微信自动化 - 通用入口脚本
功能:根据参数调用 send_message.py 或 send_file.py
用法:
# 发送文本消息
python main.py 文件传输助手 测试消息
# 发送文件/图片
python main.py 文件传输助手 C:/path/to/image.png --file
# 不添加签名后缀
python main.py 文件传输助手 测试消息 --no-signature
"""
import sys
import os
import subprocess
# 设置标准输出为 UTF-8 编码,解决 PowerShell 控制台中文乱码问题
if sys.platform == 'win32':
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
WECHAT_SEND_MSG = os.path.join(SCRIPT_DIR, 'send_message.py')
WECHAT_SEND_FILE = os.path.join(SCRIPT_DIR, 'send_file.py')
def check_scripts():
"""检查所需脚本是否存在"""
missing = []
if not os.path.exists(WECHAT_SEND_MSG):
missing.append('send_message.py')
if not os.path.exists(WECHAT_SEND_FILE):
missing.append('send_file.py')
if missing:
print("[ERROR] 缺少以下脚本:" + ", ".join(missing))
return False
return True
def send_text(chat_name, message, add_signature=True):
"""发送文本消息 - 调用 send_message.py"""
cmd = [sys.executable, WECHAT_SEND_MSG, chat_name, message]
if not add_signature:
cmd.append('--no-signature')
result = subprocess.run(cmd)
return result.returncode == 0
def send_file(chat_name, file_path):
"""发送文件/图片 - 调用 send_file.py"""
cmd = [sys.executable, WECHAT_SEND_FILE, chat_name, file_path]
result = subprocess.run(cmd)
return result.returncode == 0
def main():
"""主函数"""
if len(sys.argv) < 3:
print("微信自动化 - 通用入口脚本")
print("="*60)
print("用法:")
print(" # 发送文本消息")
print(" python main.py <聊天名称> <消息内容>")
print()
print(" # 发送文件/图片")
print(" python main.py <聊天名称> <文件路径> --file")
print()
print("示例:")
print(" python main.py 文件传输助手 测试消息")
print(" python main.py 张三 C:\\image.png --file")
print("="*60)
sys.exit(1)
if not check_scripts():
sys.exit(1)
chat_name = sys.argv[1]
if '--file' in sys.argv:
file_index = sys.argv.index('--file')
if file_index > 2:
file_path = sys.argv[2]
success = send_file(chat_name, file_path)
else:
print("[ERROR] 请提供文件路径")
sys.exit(1)
else:
message = ' '.join(sys.argv[2:])
add_signature = '--no-signature' not in message
message = message.replace(' --no-signature', '')
success = send_text(chat_name, message, add_signature)
sys.exit(0 if success else 1)
if __name__ == '__main__':
main()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
微信搜索聊天脚本 - 快捷键版
功能:使用 Ctrl+F 快捷键搜索并打开指定聊天窗口
技巧:先打开文件传输助手激活焦点,再搜索目标聊天
"""
import pyautogui
import pyperclip
import time
import sys
import subprocess
import os
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = True
def wake_wechat():
"""唤醒微信(调用 wechat-wake 技能)"""
print("\n[前置] 唤醒微信...")
script_dir = os.path.dirname(os.path.abspath(__file__))
wake_script = os.path.join(script_dir, 'wake.py')
if os.path.exists(wake_script):
subprocess.run([sys.executable, wake_script], check=True)
else:
print(" [WARN] 未找到 wake.py 脚本,跳过唤醒")
time.sleep(1)
def open_search_box():
"""按 Ctrl+F 打开搜索框"""
print(" 按 Ctrl+F 打开搜索框...")
pyautogui.hotkey('ctrl', 'f')
time.sleep(0.5)
def paste_and_enter(chat_name):
"""使用剪贴板粘贴文字并按 Enter"""
print(f" 复制到剪贴板:{chat_name}")
pyperclip.copy(chat_name)
time.sleep(0.3)
print(" 按 Ctrl+V 粘贴...")
pyautogui.hotkey('ctrl', 'v')
time.sleep(0.8)
print(" 按 Enter 选择第一个搜索结果...")
pyautogui.press('enter')
time.sleep(1)
def search_chat(chat_name):
"""
搜索聊天窗口(直接搜索目标)
Args:
chat_name: 聊天名称
"""
print("\n[步骤 1] 打开搜索框...")
open_search_box()
print(f"\n[步骤 2] 搜索:{chat_name}...")
paste_and_enter(chat_name)
print("\n[步骤 3] 重置微信窗口焦点(Ctrl+Alt+S × 2)...")
print(" 第一次:隐藏微信...")
pyautogui.hotkey('ctrl', 'alt', 's')
time.sleep(1)
print(" 第二次:唤醒微信...")
pyautogui.hotkey('ctrl', 'alt', 's')
time.sleep(1.5)
print("\n[完成] 已进入聊天窗口,光标应已聚焦到输入框")
time.sleep(0.5)
def main(chat_name):
"""主函数"""
print("="*60)
print("微信搜索聊天窗口 - 快捷键版")
print("="*60)
print(f"目标聊天:{chat_name}")
print("="*60)
wake_wechat()
search_chat(chat_name)
print("\n" + "="*60)
print("[完成] 聊天窗口已打开,光标应已聚焦到输入框")
print("="*60)
return 0
if __name__ == '__main__':
if len(sys.argv) < 2:
print("用法:python search_chat.py <聊天名称>")
print("示例:python search_chat.py '张三'")
print(" python search_chat.py '项目群'")
sys.exit(1)
chat_name = ' '.join(sys.argv[1:])
sys.exit(main(chat_name))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
微信发送文件/图片脚本(完整版)
功能:唤醒微信 → 搜索聊天 → 发送文件/图片
用法:
python send_file.py 文件传输助手 C:/path/to/image.png
python send_file.py 张三 C:/path/to/file.pdf
"""
import pyautogui
import time
import sys
import os
import subprocess
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = True
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
WECHAT_WAKE = os.path.join(SCRIPT_DIR, 'wake.py')
WECHAT_SEARCH = os.path.join(SCRIPT_DIR, 'search_chat.py')
def copy_file_to_clipboard(file_path):
"""
使用 PowerShell Set-Clipboard 复制文件到剪贴板
Args:
file_path: 文件绝对路径
Returns:
bool: 是否成功
"""
abs_path = os.path.abspath(file_path)
print(f"\n[步骤 3] 复制文件到剪贴板...")
print(f" 文件:{file_path}")
print(f" 执行 PowerShell 命令...")
ps_command = f"Set-Clipboard -Path '{abs_path}'"
result = subprocess.run(
['powershell', '-Command', ps_command],
capture_output=True,
text=True
)
if result.returncode == 0:
print(" [OK] 文件已复制到剪贴板")
return True
else:
print("[ERROR] PowerShell 命令失败:" + result.stderr)
return False
def send_file(file_path):
"""
发送文件/图片(假设聊天窗口已打开)
Args:
file_path: 文件路径
"""
if not os.path.exists(file_path):
print(f"[ERROR] 文件不存在:{file_path}")
return False
# 步骤 3: 复制文件到剪贴板
success = copy_file_to_clipboard(file_path)
if not success:
print("[ERROR] 复制文件失败")
return False
time.sleep(0.5)
print("\n[步骤 4] 粘贴文件到微信...")
pyautogui.hotkey('ctrl', 'v')
time.sleep(1.5)
print("\n[步骤 5] 发送文件...")
pyautogui.press('enter')
time.sleep(1)
print("\n[完成] 文件已发送")
return True
def main(chat_name, file_path):
"""主函数 - 完整流程"""
print("="*60)
print("微信自动化 - 发送文件/图片")
print("="*60)
print(f"目标聊天:{chat_name}")
print(f"文件路径:{file_path}")
print("="*60)
if not os.path.exists(file_path):
print(f"[ERROR] 文件不存在:{file_path}")
return False
# 步骤 1: 唤醒微信
print("\n[步骤 1/5] 唤醒微信...")
if os.path.exists(WECHAT_WAKE):
result = subprocess.run([sys.executable, WECHAT_WAKE], capture_output=True, text=True)
if result.returncode != 0:
print("[WARN] 唤醒微信失败,继续尝试...")
else:
print("[WARN] wake.py 不存在,跳过")
time.sleep(1)
# 步骤 2: 搜索聊天
print(f"\n[步骤 2/5] 搜索'{chat_name}'...")
if os.path.exists(WECHAT_SEARCH):
result = subprocess.run([sys.executable, WECHAT_SEARCH, chat_name],
capture_output=True, text=True)
if result.returncode != 0:
print("[ERROR] 搜索聊天窗口失败")
print(result.stderr)
return False
else:
print("[WARN] search_chat.py 不存在,跳过")
time.sleep(2)
# 步骤 3-5: 发送文件
success = send_file(file_path)
print("\n" + "="*60)
if success:
print("[OK] 文件已发送到:" + chat_name)
return True
else:
print("[失败] 文件发送失败")
return False
if __name__ == '__main__':
if len(sys.argv) < 3:
print("用法:python send_file.py <聊天名称> <文件路径>")
print("示例:")
print(" python send_file.py 文件传输助手 C:\\image.png")
print(" python send_file.py 张三 C:\\document.pdf")
sys.exit(1)
chat_name = sys.argv[1]
file_path = sys.argv[2]
success = main(chat_name, file_path)
sys.exit(0 if success else 1)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
微信发送消息脚本(完整版)
功能:唤醒微信 → 搜索聊天 → 发送文本消息
用法:
python send_message.py 文件传输助手 测试消息
python send_message.py 张三 你好,最近怎么样?
python send_message.py 文件传输助手 测试消息 --no-signature
"""
import pyautogui
import pyperclip
import time
import sys
import os
import subprocess
pyautogui.PAUSE = 0.5
pyautogui.FAILSAFE = True
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
WECHAT_WAKE = os.path.join(SCRIPT_DIR, 'wake.py')
WECHAT_SEARCH = os.path.join(SCRIPT_DIR, 'search_chat.py')
def send_message(message, add_signature=True):
"""
在已打开的聊天窗口中发送消息
Args:
message: 消息内容
add_signature: 是否添加签名后缀
"""
signature = "\n\n" + "-"*34 + "\n[小虎] 本消息由王老师 AI 助理自动发送"
if add_signature:
message = message + signature
print("\n[步骤 3] 复制消息到剪贴板...")
print(" 消息内容:" + message[:50] + "...")
pyperclip.copy(message)
time.sleep(0.3)
print("\n[步骤 4] 粘贴到输入框...")
pyautogui.hotkey('ctrl', 'v')
time.sleep(0.5)
print("\n[步骤 5] 按 Enter 发送...")
pyautogui.press('enter')
time.sleep(1)
print("\n[完成] 消息已发送")
def main(chat_name, message, add_signature=True):
"""主函数 - 完整流程"""
print("="*60)
print("微信自动化 - 发送文本消息")
print("="*60)
print(f"目标聊天:{chat_name}")
print(f"消息内容:{message[:50]}...")
print("="*60)
# 步骤 1: 唤醒微信
print("\n[步骤 1/5] 唤醒微信...")
if os.path.exists(WECHAT_WAKE):
result = subprocess.run([sys.executable, WECHAT_WAKE], capture_output=True, text=True)
if result.returncode != 0:
print("[WARN] 唤醒微信失败,继续尝试...")
else:
print("[WARN] wake.py 不存在,跳过")
time.sleep(1)
# 步骤 2: 搜索聊天
print(f"\n[步骤 2/5] 搜索'{chat_name}'...")
if os.path.exists(WECHAT_SEARCH):
result = subprocess.run([sys.executable, WECHAT_SEARCH, chat_name],
capture_output=True, text=True)
if result.returncode != 0:
print("[ERROR] 搜索聊天窗口失败")
print(result.stderr)
return False
else:
print("[WARN] search_chat.py 不存在,跳过")
time.sleep(2)
# 步骤 3-5: 发送消息
send_message(message, add_signature)
print("\n" + "="*60)
print("[OK] 消息已发送到:" + chat_name)
print("="*60)
return True
if __name__ == '__main__':
if len(sys.argv) < 3:
print("用法:python send_message.py <聊天名称> <消息内容> [--no-signature]")
print("示例:")
print(" python send_message.py 文件传输助手 测试消息")
print(" python send_message.py 张三 你好,最近怎么样?")
print(" python send_message.py 文件传输助手 测试 --no-signature")
sys.exit(1)
chat_name = sys.argv[1]
args = sys.argv[2:]
add_signature = '--no-signature' not in args
if '--no-signature' in args:
args.remove('--no-signature')
message = ' '.join(args)
success = main(chat_name, message, add_signature)
sys.exit(0 if success else 1)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
微信唤醒脚本 - Windows API 版本
功能:使用 Windows API 唤醒微信窗口到最前
"""
import ctypes
import ctypes.wintypes
import pyautogui
import time
import sys
# Windows API 常量
SW_RESTORE = 9
SW_SHOW = 5
pyautogui.PAUSE = 0.3
pyautogui.FAILSAFE = True
# 加载 Windows API 库
user32 = ctypes.windll.user32
# 定义 WNDENUMPROC 回调函数类型
WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.wintypes.BOOL, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM)
def get_wechat_windows():
"""获取所有微信窗口句柄"""
wechat_windows = []
def enum_callback(hwnd, lParam):
if user32.IsWindowVisible(hwnd):
class_name = ctypes.create_unicode_buffer(256)
user32.GetClassNameW(hwnd, class_name, 256)
class_name = class_name.value
if 'WeChat' in class_name or 'WeChatMainWndForPC' in class_name or 'Qt51514QWindowIcon' in class_name:
wechat_windows.append(hwnd)
return True
callback = WNDENUMPROC(enum_callback)
user32.EnumWindows(callback, 0)
return wechat_windows
def get_window_title(hwnd):
"""获取窗口标题"""
title = ctypes.create_unicode_buffer(256)
user32.GetWindowTextW(hwnd, title, 256)
return title.value
def is_window_minimized(hwnd):
"""检查窗口是否最小化"""
return bool(user32.IsIconic(hwnd))
def get_foreground_window():
"""获取当前前台窗口句柄"""
return user32.GetForegroundWindow()
def set_foreground_window(hwnd):
"""设置窗口为前台"""
return bool(user32.SetForegroundWindow(hwnd))
def show_window(hwnd, cmd):
"""显示窗口"""
return bool(user32.ShowWindow(hwnd, cmd))
def restore_window(hwnd):
"""恢复最小化的窗口"""
if is_window_minimized(hwnd):
return show_window(hwnd, SW_RESTORE)
return True
def bring_to_front(hwnd):
"""将窗口置前"""
if not restore_window(hwnd):
return False
time.sleep(0.3)
return set_foreground_window(hwnd)
def main():
"""主函数"""
print("="*60)
print("微信唤醒 - Windows API 版本")
print("="*60)
print("\n[1/5] 查找微信窗口...")
wechat_windows = get_wechat_windows()
if not wechat_windows:
print(" [WARN] 未找到微信窗口(可能在托盘)")
print("\n[2/5] 尝试快捷键唤醒 (ctrl+alt+s)...")
pyautogui.hotkey('ctrl', 'alt', 's')
time.sleep(2)
wechat_windows = get_wechat_windows()
if not wechat_windows:
print(" [ERROR] 仍未找到微信窗口(微信可能未启动)")
print("\n" + "="*60)
print("[失败] 请先启动微信")
print("="*60)
return 1
print(" [OK] 快捷键唤醒成功,找到微信窗口")
print(f" 找到 {len(wechat_windows)} 个微信窗口")
for i, hwnd in enumerate(wechat_windows):
title = get_window_title(hwnd)
print(f" 窗口 {i+1}: 句柄={hwnd}, 标题='{title}'")
wechat_hwnd = wechat_windows[0]
print("\n[3/6] 检查微信状态...")
is_minimized = is_window_minimized(wechat_hwnd)
is_foreground = (get_foreground_window() == wechat_hwnd)
print(f" 是否最小化:{'是' if is_minimized else '否'}")
print(f" 是否在前台:{'是' if is_foreground else '否'}")
if is_foreground and not is_minimized:
print(" [OK] 微信已在最前")
print("\n" + "="*60)
print("[完成] 微信已在最前,无需唤醒")
print("="*60)
return 0
print("\n[4/6] 唤醒微信...")
if is_minimized:
print(" 窗口最小化,执行恢复...")
success = bring_to_front(wechat_hwnd)
time.sleep(0.5)
if not success:
print(" [WARN] SetForegroundWindow 失败,尝试备用方案...")
show_window(wechat_hwnd, 6)
time.sleep(0.3)
show_window(wechat_hwnd, SW_RESTORE)
time.sleep(0.3)
set_foreground_window(wechat_hwnd)
print("\n[5/6] 确认唤醒结果...")
is_foreground_after = (get_foreground_window() == wechat_hwnd)
if is_foreground_after:
title = get_window_title(wechat_hwnd)
print(f" [OK] 微信唤醒成功")
print(f" 窗口标题:'{title}'")
else:
print(" [WARN] 微信可能仍被其他窗口遮挡")
print("\n[6/6] 最终确认...")
print("\n" + "="*60)
if is_foreground_after:
print("[完成] 微信已唤醒到最前")
return 0
else:
print("[警告] 微信已恢复但可能未在最前")
return 0
if __name__ == '__main__':
sys.exit(main())