下面是我的脚本:
Code: Select all
~mButton::
WinGetClass, class, A ; 这个语句是专门对付 Gtalk 的。获得当前活动窗口(最后的 A 参数就是代表当前活动窗口)的类(class)名,并赋值给 class。类名这个词好专业啊。GTalk 的聊天窗口的标题是没有规律的,但它们都是同一类,其类名都是 Chat View。
IfInString, class, Chat ; 判断 class 中是否含有 chat
{
send !{F4}
return ; 有的话,说明很可能(99.9%)是 Gtalk 的聊天窗口啦,发送 Alt + F4 关闭聊天窗口。并且结束脚本。
}
WinGetActiveTitle, Title ; 获取当前活动窗口的标题,赋值给 Title
IfInString, Title, Chrome ; 判断 Title 中是否含有 Chrome ,也可以试试用类名来判断。文末会介绍怎么获得一个窗口的类名。
{
send {ESC}
return
}
WinGetActiveTitle, Title ; 获取当前活动窗口的标题,赋值给 Title
IfInString, Title, Internet Download Manager ; 判断 Title 中是否含有 IDM。
{
Process, Close, IDMan.exe
return
}
else ; 这个 else 是多余的,历史遗留问题。
WinClose, %Title%
return
#NoTrayIcon