Question

I would like to write an Script to determine whether the Master System Volume is muted, to mute it or unmute it.

Basically I want to do what is explained in this answer:

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys(chr(&hAD))

...but with a little improvement, what I would like to perform are two procedures, one for mute and the other for unmute, so I need to determine if it's muted or not.

I already know how to do this using 3rd party libraries in other languages, but I need to do it with VisualBasicScipt so I have no idea where to start in this limited language, maybe WMI tells something about the current master volume level? if yes then I suppose that could save me.

Any ideas?

Was it helpful?

Solution 2

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.

This Runs The Master Volume And Unmutes IT And Sets The Volume To 100 If You Want To Decrease The Volume Do The Following

oShell.SendKeys('{PGDN}')

OTHER TIPS

VBScript/Windows Script Host/WMI do not provide this info. You'll need to use third-party utilities or some other programming languages, e.g.:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top