我想看看我是否拥有有效的Chrome,但不是在其他网页中,而是在特定页面中。
如果我使用
IfWinExist ahk_class Chrome_WidgetWin_1
该脚本会发现ALSO Chrome已与其他网页一起打开,我不希望这样。
我该怎么办?
答案 0 :(得分:2)
我不确定我是否完全明白你想要实现什么,但我曾经编写了一个循环浏览所有Chrome标签的脚本,这里稍作调整,以便它会遍历所有标签并激活你想要的标签: / p>
^!Space::
{
IsSiteOpen()
return
}
IsSiteOpen()
{
Global TabTitleExist
TabTitle = autohotkey
SetTitleMatchMode 2
IfWinExist, %TabTitle%
{
WinActivate, %TabTitle%
WinMinimize, %TabTitle%
MsgBox, 64, %TabTitle%, It is open
return
}
LoopChromeTabs(TabTitle)
if (TabTitleExist = 1)
{
WinActivate, %TabTitle%
WinMinimize, %TabTitle%
MsgBox, 64, %TabTitle%, It is open
return
}
return
}
LoopChromeTabs(TabTitle)
{
Global TabTitleExist
IfWinExist, ahk_class Chrome_WidgetWin_1
{
; Get current open tab title
WinGetTitle, FirstTitle
; Go through all open tabs and find the tab we are looking for or quit
Loop
{
WinActivate ahk_class Chrome_WidgetWin_1
Send ^{Tab}
WinGetTitle, CurrentTitle
; After we changed tab have we found our tab?
IfWinExist, %TabTitle%
{
TabTitleExist = 1
break
}
; We went through all tabs and we should stop there
If (FirstTitle = CurrentTitle)
break
}
}
}
https://github.com/ilirb/ahk-scripts/blob/master/executable/source/GoogleMusicRemote.ahk