Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahnz authored Oct 18, 2020
1 parent 8f53b9e commit d2bd440
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions AHK/mute_current_application.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@
#Include VA.ahk
#SingleInstance force

LAlt & q:: Send {Alt Down}{Tab}{Alt Up}

~!TAB:: ; ALT+TAB hotkey - toggle mute state of active window
WinGet, ActivePid, PID, A
If WinActive("ahk_exe RDR2.exe") ; Red Dead Redemption 2
{
if !(Volume := GetVolumeObject(ActivePid))
return
VA_ISimpleAudioVolume_SetMute(Volume, true) ;Toggle mute state
ObjRelease(Volume)
}
Sleep 200
WinWaitActive, ahk_exe RDR2.exe, ,
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
if !(Volume := GetVolumeObject(ActivePid))
return
VA_ISimpleAudioVolume_SetMute(Volume, false) ;Toggle mute state
ObjRelease(Volume)
}
WinGet, ActivePid, PID, A
If WinActive("ahk_exe RDR2.exe") ; Red Dead Redemption 2
{
if !(Volume := GetVolumeObject(ActivePid))
return
VA_ISimpleAudioVolume_SetMute(Volume, true) ;Toggle mute state
ObjRelease(Volume)
Sleep 200
WinWaitActive, ahk_exe RDR2.exe, ,
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}else {
if !(Volume := GetVolumeObject(ActivePid))
return
VA_ISimpleAudioVolume_SetMute(Volume, false) ;Toggle mute state
ObjRelease(Volume)
}}

return

;Required for app specific mute
Expand Down

0 comments on commit d2bd440

Please sign in to comment.