This could be done with AHK's #IfWinActive / #IfWinNotActive directives and/or WinActive() / WinNotActive() functions.
I haven't had the time/opportunity to develop or test this, but I didn't want to lose the idea. Here is the original suggestion for simply disabling the hotkey while the game is not focused (proposed by Cholerix):
Hi, I tried your PP material loading scripts and it didn't take long for me to trigger it while tabbed out of the game.
So I had a look if AHK has something to make scripts window specific and it does
By putting #IfWinActive ahk_exe EliteDangerous64.exe in line 142, before the list of hotkeys, they trigger only when elite is active
I don't have odyssey, so I don't know if the executable has a different name
This could be done with AHK's #IfWinActive / #IfWinNotActive directives and/or WinActive() / WinNotActive() functions.
I haven't had the time/opportunity to develop or test this, but I didn't want to lose the idea. Here is the original suggestion for simply disabling the hotkey while the game is not focused (proposed by Cholerix):