2189Views6Replies

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.

6 Replies

user
g-oneBest Answer (author)2013-02-09

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
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)g-one2013-02-09

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

Select as Best AnswerUndo Best Answer

user
TheRealRocketBurns (author)2014-07-10

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.

Select as Best AnswerUndo Best Answer

user
frollard (author)2013-02-08

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.

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)frollard2013-02-08

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.

Select as Best AnswerUndo Best Answer

user
frollard (author)Prof. Pickle2013-02-09

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

Select as Best AnswerUndo Best Answer