Code: Select all
settitlematchmode, 2
^f1::
If Not WinExist("ahk_exe chrome.exe")
Return
WinGetTitle, Title, A
WinActivate, ahk_class Chrome_WidgetWin_1
WinWaitActive, ahk_class Chrome_WidgetWin_1
Loop
{
WinGetTitle, CurrentWindowTitle, ahk_class Chrome_WidgetWin_1
If CurrentWindowTitle contains YouTube ; The title of the Chrome tab to which the command is to be sent
{
send {Space} ;The command that is sent
break
} else {
Send, ^{Tab}
}
}
WinActivate, %Title%
WinWaitActive, %Title%
Return