Code: Select all
Run "notepad.exe",,, ¬epad_pid ; 测试发现win11环境下,该命令获取的进程ID不准确
if notepad_id := WinWait("ahk_pid " notepad_pid,, 5)
{
WinActivate "ahk_id " notepad_id
WinMove 0, 0, A_ScreenWidth/4, A_ScreenHeight/2
}
MsgBox notepad_pid
MsgBox notepad_id
Code: Select all
notepad_pid_2 := "117596"
if notepad_id_2 := WinWait("ahk_pid " notepad_pid_2,, 5)
{
WinActivate "ahk_id " notepad_id_2
WinMove 0, 0, A_ScreenWidth/4, A_ScreenHeight/2
}
MsgBox notepad_pid_2
MsgBox notepad_id_2
谢谢~