如何使用 Autohotkey 专注于现有的 Google Chrome 选项卡,而不是“容器”窗口?
细节
谷歌浏览器似乎用一个容器窗口句柄来表示每个窗口,其中包含一个或多个选项卡。选项卡(至少是当前的)有自己的窗口句柄。选项卡窗口句柄有窗口标题(目前都以“- Google Chrome”结尾),而容器窗口句柄本身没有。以下自动热键代码不适用于 Google Chrome:
^+i::
if WinExist("ahk_class Chrome_WidgetWin_0")
WinActivate
else
Run "C:\Users\vleeshue\AppData\Local\Google\Chrome\Application\chrome.exe"
return
Run Code Online (Sandbox Code Playgroud)
如果 Google Chrome 窗口存在或将运行 Google Chrome,则此绑定将重点放在 Google Chrome 窗口上。但是,它通常会以容器窗口为目标(在 Window Spy 中,窗口标题为空白)。激活容器窗口将禁止使用 Google Chrome 键盘快捷键。无法访问的键盘快捷键包括所有重要的 ctrl+l 以访问多功能栏。由于我还没有找到一致激活选项卡窗口而不是容器窗口的方法,我的解决方法是使用鼠标,但如果可能的话,我更愿意避免这种情况。
窗口间谍截图
背景
当前 Google Chrome 版本:5.0.317.2 dev
我使用的一个常见的自动热键绑定是一个键盘快捷键,用于聚焦特定应用程序(如果它已经在运行)或运行该应用程序(如果它没有运行)。
例如,我将它用于 foobar2000
^+m::
If WinExist("foobar2000")
WinActivate
else
Run "C:\Program Files (x86)\foobar2000\foobar2000.exe"
return
Run Code Online (Sandbox Code Playgroud)