编辑工作版本AutoHotkey的简单ControlSend谷歌浏览器
!j::
SetTitleMatchMode, 2
ControlGet, OutputVar, Hwnd,,Chrome_RenderWidgetHostHWND1, Google Chrome
ControlFocus,,ahk_id %outputvar%
ControlSend, , {Space} , Google Chrome
原帖:
DetectHiddenWindows, on
!j::
IfWinExist, ahk_exe chrome.exe
ControlSend, ahk_exe chrome.exe, {SPACE}
return
我要的是能够切换播放/暂停YouTube影片是通过镀铬玩。铬窗口不是活动窗口,但显示在我的第二台显示器上。我尝试过使用WindowSpy中的ahk_class Chrome_WidgetWin_1,并使用ClassNN:Chrome_RenderWidgetHostHWND1做一个ControlClick,但似乎没有正确发送{SPACE}或CLICK来暂停视频。
WindowSpy信息(视频标题不会是一致的):https://autohotkey.com/docs/commands/ControlSend.htm
ControlSend, Control, Keys, WinTitle
,而你有
ControlSend, ahk_exe chrome.exe, {SPACE}
ahk_exe chrome.exe
认为:
Calculus 2 Lecture 10.2: Introduction to Parametric Equations - YouTube - Google Chrome
ahk_class Chrome_WidgetWin_1
ahk_exe chrome.exe
Absolute: -908, 634 (less often used)
Relative: 1012, 634 (default)
Client: 1012, 634 (recommended)
ClassNN: Intermediate D3D Window1
Text:
Color: 05070D (Red=05 Green=07 Blue=0D)
x: 0 y: 0 w: 1920 h: 1080
Client: x: 0 y: 0 w: 1920 h: 1080
Chrome Legacy Window
Chrome Legacy Window
Chrome Legacy Window
Chrome Legacy Window