m::Send {Volume_Mute} is for the Master Volume... I need code only for mute/unmuting specific program...

IfWinExist ahk_class Chrome_WidgetWin_1
m::Send {Volume_Mute} 

won't work...


Easiest way to mute a specific program with AHK is to download Nircmd, copy to the windows directory (it has a button when you run the exe) and adapt the following

WinGet, WinProcessName, ProcessName, A
run nircmd muteappvolume %WinProcessName% 2
  • Or, if you know the .exe name: Run, "Lib\nircmd.exe" muteappvolume "myprogram.exe" 2 to toggle mute/unmute – Epskampie Apr 28 at 11:15

You need #IfWinExist the # is very important - there is a big differences between IfWinExist with and without the # you can read more about it here https://autohotkey.com/docs/commands/_IfWinActive.htm

  • This may fix an error in the code that OP posted, however even with that code working, it won't actually do what the OP is trying to accomplish. – 3D1T0R May 17 '18 at 6:59

For this answer, I'm assuming that you're using Windows Vista or later, as I'm not currently aware of a solution for Windows XP or earlier.

I haven't had time to try this yet, but you should be able to do what you want (mute a single program without muting everything else) using the Vista Audio Control Functions, by Lexikos.

I'll edit my answer to include more details when I have a little more time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.