Skip to content

Instantly share code, notes, and snippets.

@Epskampie
Created April 28, 2019 11:12
Show Gist options
  • Save Epskampie/ca5da58951f083b0b4a190977f234008 to your computer and use it in GitHub Desktop.
Save Epskampie/ca5da58951f083b0b4a190977f234008 to your computer and use it in GitHub Desktop.
Autohotkey fullscreen/windowed and mute/unmute game with one button (scroll lock)
; Download NirCmd.exe and put it in a "Lib" folder next to this script
; https://www.nirsoft.net/utils/nircmd.html
winTitle := "Forza Motorsport 7"
procName := "forzamotorsport7.exe"
Pause::
Run, "Lib\nircmd.exe" muteappvolume %procName% 2
return
ScrollLock::
If WinExist(winTitle) {
; MsgBox maximize
Run, "Lib\nircmd.exe" muteappvolume %procName% 0
WinActivate ; use the window found above
Sleep, 100
SendInput, #+{Enter} ; Send Win+Shift+Enter
} else {
; MsgBox minimize
Run, "Lib\nircmd.exe" muteappvolume %procName% 1
SendInput, #+{Enter} ; Send Win+Shift+Enter
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment