I frequently use the function keys as media keys on my laptop, i.e. Pause/Play music, Change screen brightness, etc. However, when using Excel I would like to use the function keys as their intended function, e.g. F4 toggles A1 -> $A$1 instead of going to the next song.
I know I can achieve this if I enable/disable function lock, but I was wondering if there was a way to do it automatically for a specific program. So when I am working in Excel, function lock is disabled and then it will be re-enabled when I'm using another program. The easiest way might be to write a script or something that toggles function lock when Excel is in focus, but I have no idea how to do that. Any help is appreciated, thanks!