用Hwnd来标识窗口
using run notepad as an example:
1::
Run notepad, , ,thisPID
WinWait ahk_pid %thisPID%
WinGet thisHwnd, ID, ahk_pid %thisPID%
WinActivate ahk_id %thisHwnd%
WinWaitActive ahk_id %thisHwnd%
Sleep 2000
WinClose ahk_id %thisHwnd%
WinWaitClose ahk_id %thisHwnd%
Run notepad, , ,thisPID
WinWait ahk_pid %thisPID%
WinGet thisHwnd, ID, ahk_pid %thisPID%
WinActivate ahk_id %thisHwnd%
WinWaitActive ahk_id %thisHwnd%
Sleep 2000
WinClose ahk_id %thisHwnd%
WinWaitClose ahk_id %thisHwnd%
posted on 2008-08-26 20:46 zendevelop 阅读(208) 评论(0) 编辑 收藏 举报