Author Options:

Program or script to change volume...? Answered

Another question that is way out of my league (woe is me). 

I need (or rather want) a program, in either Java or VBs (if there's a better one like Python or something, that would be alright too) to change the volume of a Windows computer. 

It would also be a good showcase of your skills to make it able to change the volume of a specific program or application. 

The way I intend to use it is as if it were a function, rather than a program. So a different script will activate it (perhaps by writing it, which in Java I don't think is possible) and then set the volume and the program to change the volume of. If that can't be achieved, could it be made to read a text file (or something else) with two lines on it; the first the program, the second the volume. If the first line says something like none, It would change the volume of the whole computer.

Hopefully I've given you a good enough description to make it clear exactly what to do. Thank you in advance.



Best Answer 6 years ago

Prof. Pickle

As you already know I'm more familiar with C. So I wrote a small program for you in C and WinAPI. It's quick'n'dirty since it does nothing but emulating the multimedia keys on your keyboard.
Of course I attached the C source code as well. You can download "mmctrl.zip" here.
For additional information how it works check out

Prof. Pickleg-one

Answer 6 years ago

Thank you very much. You'll be in the credits of a project me and someone else are currently working on.


5 years ago

it might be too late, but if you ever need a vbscript function, here it is:

set oShell = CreateObject("WScript.Shell")

oShell.run"%SystemRoot%\System32\SndVol.exe "'Runs The Master Volume App.
WScript.Sleep 1500 'Waits For The Program To Open
oShell.SendKeys("{PGUP}")'Turns Up The Volume 20, If It Is Muted Then It Will Unmute It
oShell.SendKeys("{PGUP}")'Turns Up The Volume 20
oShell.SendKeys("{PGUP}")'Turns Up The Volume 20
oShell.SendKeys("{PGUP}")'Turns Up The Volume 20
oShell.SendKeys("{PGUP}")'Turns Up The Volume 20
oShell.SendKeys"%{F4}"' ALT F4 To Exit The App.


6 years ago

What operating system?

In windows 7, you can adjust master volume, as well as the individual volumes of any other programs separately. Clicking on the volume icon in the system tray (bottom right, looks like a speaker) should bring up the volume. Right click/playback should show all programs.

Prof. Picklefrollard

Answer 6 years ago

Thanks, I guess. However, as my questions states, I want a program to do this automatically. Such as in a game you can change the game volume from within.

frollardProf. Pickle

Answer 6 years ago

that's not automatic - you want something that assigns hotkeys to existing commands. Correct?