Autohotkey 自动热键-将密钥发送到特定应用程序-Media Player Classic

Autohotkey 自动热键-将密钥发送到特定应用程序-Media Player Classic,autohotkey,Autohotkey,使用自动热键,我想通过热键^l发送正斜杠键,即。{/}连续睡眠10秒后,仅当媒体播放器应用程序是活动窗口时,才向其发送10000。如果任何其他窗口是活动窗口,则不应发送正斜杠 热键^l应为切换键(再次按下该键将停止发送正斜杠键) ahk_类媒体播放器经典: ahk_类媒体播放器经典 提前感谢您的指点/帮助 #IfWinActive ahk_class MediaPlayerClassicW ; only if it is the active window ^l:: se

使用自动热键,我想通过热键^l发送正斜杠键,即。{/}连续睡眠10秒后,仅当媒体播放器应用程序是活动窗口时,才向其发送10000。如果任何其他窗口是活动窗口,则不应发送正斜杠

热键^l应为切换键(再次按下该键将停止发送正斜杠键)

ahk_类媒体播放器经典: ahk_类媒体播放器经典

提前感谢您的指点/帮助

#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

工作得很好。非常感谢您不厌其烦地编写了我所需的完整代码和注释,以及帮助我了解更多信息的帮助文档的指针。