【问题标题】:autohotkey, to go a tab in chrome自动热键,在 chrome 中打开一个标签
【发布时间】:2020-11-24 03:50:05
【问题描述】:

我打开了许多 chrome 窗口。每个 chrome 窗口都有许多选项卡。

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

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

如果选项卡的名称未激活,则当我使用热键时不会发生任何事情。

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

【问题讨论】:

    标签: google-chrome autohotkey


    【解决方案1】:

    我使用此功能取得了不同程度的成功。它发送 CtrlTab 直到找到您想要的选项卡标题或找到具有原始标题的选项卡。我认为如果您有多个 windows 以及多个 tabs,您会发现您的情况存在问题。您也可以调整它以在窗口之间切换。

    ; 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
    }
    

    【讨论】:

    • 一个不幸的解决方案是使用所有其他浏览器,如 firefox、opera 和上帝禁止 IE...
    猜你喜欢
    • 1970-01-01
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多