AutoHotkey:当特定应用程序处于焦点时如何更改键行为

AutoHotkey: how to change key behaviour when specific app is in focus

我想在按下 RIGHT 时额外发送 CTRL+RIGHT,以防 Windows 媒体播放器当前处于焦点状态。到目前为止,我取得的成就是它在 WMP 为 运行 的情况下有效。我如何更改脚本,使其仅在 WMP window 当前处于焦点时才反应?

SetTimer, KeepRunning
return
KeepRunning:
  ifWinActive, "Windows Media Player"
  {
     Right::Send ^{Right}{Right}
  }
return

PS:我是 AutoHotkey 的新手,所以欢迎任何其他代码建议:)

查看 #If 以创建上下文相关的热键和热字串。

#Persistent    
#If winactive("Windows Media Player")
Right::Send ^{Right}{Right}
#If