禁止使用 Start-Process 启动微信!必须通过点击任务栏图标打开!
正确流程:
❌ 错误方式:Start-Process "D:\Weixin\Weixin.exe"(这只启动进程,不会打开界面)
功能坐标 (X, Y)说明显示隐藏图标1142, 744任务栏显示隐藏图标按钮微信图标1111, 701微信启动图标激活微信400, 300点击屏幕中间激活微信窗口朋友圈按钮272, 322朋友圈标签位置语音电话1055, 108聊天窗口右上角电话按钮
重要:若微信未显示在任务栏,需先点击显示隐藏图标!
powershell
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WMoments {
[DllImport("user32.dll")] public static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")] public static extern void mouse_event(int flags, int dx, int dy, int d, int e);
}
"@
# 1. 点击显示隐藏图标 (1142, 744)
[WMoments]::SetCursorPos(1142, 744)
Start-Sleep -Milliseconds 100
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
Start-Sleep -Milliseconds 300
# 2. 点击微信图标 (1111, 701)
[WMoments]::SetCursorPos(1111, 701)
Start-Sleep -Milliseconds 100
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
Start-Sleep -Milliseconds 500
# 3. 激活微信(点击屏幕中间)
[WMoments]::SetCursorPos(400, 300)
Start-Sleep -Milliseconds 100
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
Start-Sleep -Milliseconds 200
# 4. 点击朋友圈按钮
[WMoments]::SetCursorPos(272, 322)
Start-Sleep -Milliseconds 100
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
### 关闭朋友圈
点击右上角关闭按钮 (932, 108)
```powershell
# 点击右上角关闭朋友圈
[WMoments]::SetCursorPos(932, 108)
Start-Sleep -Milliseconds 100
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
正确的浏览方式:先向下滚动浏览,再慢慢往上滚回顶部
powershell
# 1. 先向下滚动100次浏览内容
for ($i = 0; $i -lt 100; $i++) {
[WMoments]::SetCursorPos(600, 400)
[WMoments]::mouse_event(0x0800, 0, 0, -50, 0)
Start-Sleep -Milliseconds 200
}
# 2. 再慢慢往上滚动300次回到顶部(是向下滚动的3倍)
for ($i = 0; $i -lt 300; $i++) {
[WMoments]::SetCursorPos(600, 400)
[WMoments]::mouse_event(0x0800, 0, 0, 50, 0)
Start-Sleep -Milliseconds 150
}
powershell
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("^f")
Start-Sleep -Milliseconds 300
[System.Windows.Forms.SendKeys]::SendWait("联系人名字")
Start-Sleep -Milliseconds 300
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
powershell
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("你好,我是贾维斯")
Start-Sleep -Milliseconds 100
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
powershell
# 点击语音电话按钮 (1055, 108)
[WMoments]::SetCursorPos(1055, 108)
Start-Sleep -Milliseconds 50
[WMoments]::mouse_event(2, 0, 0, 0, 0)
[WMoments]::mouse_event(4, 0, 0, 0, 0)
# 选择语音通话
Start-Sleep -Milliseconds 200
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.SendKeys]::SendWait("{DOWN}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")