0

First time posting. I have been playing around with creating macros that can individually adjust the sound of individual application. Found that Nircmd has the commands that I want for example if I wanted to increase the volume of Example.exe by 20% I can use a batch file that says:

Nircmd.exe changeappvolume Example.exe .2

I have tested this and it works great for changing an app I know I will be using in the background, however I would also like to change the volume of the window that I have open as my focused applications are often games or a variety of other apps. My plan is to bind these batch file to a set of hot keys that run them in the back ground but I would rather not have to write a Macro set for every single primary program.

In theory Nircmd.exe should be able to change the volume of the 'focused window' using:

Nircmd.exe changeappvolume focused .2

however I am having trouble figuring out how to focus the window of an that I am actively using.

  • "Focus" is a concept of the OS, not Nircmd. A focused window is the active window, the one currently accepting user input, the highlighted one. If you are actively using a window, it is focused. If you are actively using one window, all other windows are NOT focused. So, what is not working? According to the Nircmd reference, you're already using the correct syntax. Please edit your question to clarify the actual problem or what you are trying to accomplish. – music2myear Sep 6 '18 at 18:04
0

I'm having this same problem. I noticed that if you use a Windows Shortcut Key, all windows will lose focus. Assumedly NirCmd is becoming the foreground application, preventing it from muting the right process. However, of course if you don't, you'll only be muting explorer.exe or cmd.exe or however you ran it. Unfortunately, the best fix I've found is to change the shortcut to this:

"nircmd.exe" cmdwait 1000 changeappvolume focused .2

And then quickly re-click the process you want muted. cmdwait is in milliseconds, so this will wait for a second before doing the muteappvolume command. Quite an awkward solution.

Update: I've come up with a more automated way of doing it. First create a .txt file with the following:

sendmouse left click
wait 20
changeappvolume focused .2

Then change the shortcut to:

"nircmd.exe" script <path-to-text-file>/<text-file>.txt

Now you only need to make sure your mouse cursor is over the application you want to change the volume to.

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.