3

アクティブな Chrome があるかどうかを確認したいのですが、他の Web ページではなく特定のページで確認したいと思います。

私が使用する場合

IfWinExist ahk_class Chrome_WidgetWin_1

スクリプトは、他の Web ページで開かれた ALSO Chrome を検出しますが、それは望ましくありません。

私は何をすべきか?

4

1 に答える 1

2

あなたが何を達成したいのかよくわかりませんが、すべてのChromeタブをループするスクリプトを書いたことがあります。ここでは、すべてのタブを通過して必要なものをアクティブにするように少し調整されています。

^!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

于 2013-10-20T16:19:56.033 に答える