autohotkey,进入 chrome 中的一个选项卡

autohotkey, to go a tab in chrome

我打开了很多chromewindows。每个 chrome window 都有很多标签。

现在如果我想要的是活动选项卡,我只能通过直接调用选项卡名称转到chrome选项卡。

!t::
   WinActivate System - Google Sheets - Google Chrome
   Return

如果选项卡名称未激活,当我使用热键时没有任何反应。

如何使用自动热键搜索所有选项卡并激活我想要的选项卡?

我使用过此功能,但成败参半。它发送 CtrlTab 直到它找到您想要的选项卡标题或直到它找到具有原始标题的选项卡。我认为如果除了多个 选项卡 之外还有多个 windows,您会发现您的情况存在问题。您也可以调整它以在 windows 之间切换。

; Activate tab in Google Chrome if it exists, return true/false if exist/doesn't exist
ActivateChromeTab(soughtTab)
{
  IfWinNotExist Google Chrome
  {
    return false
  }

  WinActivate Google Chrome
  WinWaitActive Google Chrome
  WinGetTitle, currentTab, A
  firstTab := currentTab

  if (InStr(currentTab, soughtTab) > 0)
  {
    return true
  }

  Loop
  {
    Send {CtrlDown}{Tab}{CtrlUp}
    Sleep 50
    WinGetTitle, currentTab, A
    foundTab := InStr(currentTab, soughtTab) > 0
  }
  Until (foundTab || currentTab == firstTab)

  return foundTab
}