vle*_*hue 19 google-chrome autohotkey
如何使用 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)
^+i::
if WinExist("ahk_class Chrome_WindowImpl_0")
{
WinActivate
ControlFocus, Chrome_AutocompleteEditView1
}
else
Run "C:\Users\vleeshue\AppData\Local\Google\Chrome\Application\chrome.exe"
return
Run Code Online (Sandbox Code Playgroud)
应该做的伎俩
(“Chrome_AutocompleteEditView1”是 omnibar 控件的名称,因此您可以添加Send ^a
以全选)
注意:要获取ahk_class
适用于您的 Chrome 版本的 ,例如ahk_class Chrome_WindowImp1-0
,请使用AU3_Spy.exe
内部 autohotkey 目录。如果示例不起作用,这将允许您为您的 chrome 浏览器找到正确的 ahk 类。
更新:我无法重现,也许使用另一个控件会更好......要获得窗口控件列表,我使用以下代码:
#Persistent
SetTimer, WatchCursor, 100
return
WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
WinGet, ControlList, ControlList, A
ToolTip, Under Cursor:`nahk_id: %id%`nahk_class: %class%`nTitle:%title%`nControl: %control%`n`nWindow Control List:`n%ControlList%
return
Run Code Online (Sandbox Code Playgroud)
所以我的 google chrome 4.0.249.78 beta (36714) 的控件是:
归档时间: |
|
查看次数: |
43407 次 |
最近记录: |