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

Time:01-12

I want to additionally send CTRL RIGHT when I press RIGHT in case the Windows Media Player is currently in focus. What I achieved so far is that it works in case the WMP is running. How can I change the script such that it only reacts when the WMP window is currently in focus?

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

PS: I'm a total newbie regarding AutoHotkey, so any other code suggestions are welcomed :)

CodePudding user response:

Have a look at #If to create context-sensitive hotkeys and hotstrings.

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