Real'sHowTo AddThis Feed Button
Custom Search

Mute the speakersTag(s): WSH VBScript


We launch the SndVol applet and then we send the keys to change the speaker state to mute. Run the script again to toggle the speakers state.

This example is for Windows 7, the keys sent are TAB, (space) and ALT F4 to close the applet when done.

set shell = CreateObject("WScript.Shell")
shell.run"Sndvol"
WScript.Sleep 1500
shell.SendKeys"{TAB}"
shell.SendKeys" "
shell.SendKeys"%{F4}"

Note : For a Windows 64-bit, it's SndVol but for Windows 32-bit, the applet is called SndVol32.

Note : The keys may be not the same for the various Windows version.

This is a quick hack so keep in mind that SendKeys will send keys to the current active window. You can try to make sure that the SndVol is the active window by using

shell.AppActivate("Volume control")
before sending the keys but the window name depends on the Windows version and language so be careful.
blog comments powered by Disqus


If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2014
[ home ]