Autohotkey - 将密钥发送到特定应用程序 - Media Player Classic
Autohotkey - Send key to specific Application - Media Player Classic
使用 AutoHotKey,我想通过热键 (^l) 发送正斜杠键,即。 {/} 在间隔 10 秒 (Sleep,10000) 后持续播放到媒体播放器应用程序,前提是它处于活动状态 window。如果任何其他 window 是活动 window,则不应发送正斜杠。
热键 (^l) 应该是一个切换键,即再次按下它应该停止发送正斜杠键。
(Media Player Classic 的ahk_class:)
ahk_class MediaPlayerClassicW
提前感谢 pointers/help。
#IfWinActive ahk_class MediaPlayerClassicW ; only if it is the active window
^l::
send_key := !send_key ; toggles the variable "send_key" between true and false
if (send_key) ; is true
SetTimer send_the_key, 10000
else
SetTimer send_the_key, Off
return
send_the_key:
If WinActive("ahk_class MediaPlayerClassicW")
send /
else ; if you want to stop the timer whenever the window gets inactive
{
SetTimer send_the_key, Off
send_key := false
}
return
#IfWinActive ; turn off context sensitivity
使用 AutoHotKey,我想通过热键 (^l) 发送正斜杠键,即。 {/} 在间隔 10 秒 (Sleep,10000) 后持续播放到媒体播放器应用程序,前提是它处于活动状态 window。如果任何其他 window 是活动 window,则不应发送正斜杠。
热键 (^l) 应该是一个切换键,即再次按下它应该停止发送正斜杠键。
(Media Player Classic 的ahk_class:) ahk_class MediaPlayerClassicW
提前感谢 pointers/help。
#IfWinActive ahk_class MediaPlayerClassicW ; only if it is the active window
^l::
send_key := !send_key ; toggles the variable "send_key" between true and false
if (send_key) ; is true
SetTimer send_the_key, 10000
else
SetTimer send_the_key, Off
return
send_the_key:
If WinActive("ahk_class MediaPlayerClassicW")
send /
else ; if you want to stop the timer whenever the window gets inactive
{
SetTimer send_the_key, Off
send_key := false
}
return
#IfWinActive ; turn off context sensitivity