Thanks
using sendkeys does the job:
Set WshShell = CreateObject("WScript.Shel
WshShell.SendKeys (Chr(173))
How can the volume can be set to max using this method? Additionally, chr(173) just switches the mute/unmute. What I need to do is always set it to unmute. Is there a way to check what the current status is and only send chr(173) if it is currently on mute?
Main Topics
Browse All Topics





by: BillDLPosted on 2009-09-10 at 06:42:34ID: 25300071
From the following page giving an example full Visual Basic project demonstrating how to manipulate volume control settings: om/kb/1784 56 Default.as px?tabid=6 6&EntryID= 12 Downloads/ tabid/57/D efault.asp x
agazine/20 01p148id68 776.htm izmo.htm ls/nircmd. html
l") )
l") ))
http://support.microsoft.c
the author of the following page has created a self-registering *.DLL (ActiveX Control) that allows you to call it using a *.vbs script:
http://www.vinsvision.com/
http://www.vinsvision.com/
It was written as a method for setting volume level at logon via a script, but you may be able find it interesting nevertheless.
There are other methods that use 3rd-party programs to which are assigned, or to which you can assign, keyboard shortcuts, or which you can call from the command line, eg:
http://pcworld.about.com/m
http://www.grc.com/wizmo/w
http://www.nirsoft.net/uti
Further to the above, you can use a simple *.vbs code that sends the same key code as multimedia keyboards use to toggle the master volume's Mute check-box on and off without displaying the volume control:
Set WshShell = CreateObject("WScript.Shel
WshShell.SendKeys(chr(173)
or
Set WshShell = CreateObject("WScript.Shel
WshShell.SendKeys(chr(&hAD
As a matter of interest, the volume control in Windows XP (and I assume upwards) has a few command line switches:
sndvol32 /t - shows single master volume slider like System Tray
sndvol32 /r - open full mixer in "record" view
sndvol32 /p - open full mixer in "playback" view
sndvol32 /s open full mixer in playback mode - SMALL
While open Ctrl + S toggles between small and normal (wide) view.
There would be a few ways of unmuting and max'ing your master volume using basic *.vbs, but they are very clunky and if focus of the object is lost by clicking around or pressing keyboard keys while the VB Script is running, the SendKeys function can send the keystrokes to another application window. To mitigate the risk, the *.vbs code in the Code Snippet tries to maintain focus on the volume control while it simulates keystrokes. There may be better ways, but I'm not a programmer. I know the script isn't VBA, but nobody else has so far commented so you may as well see one method.
I think something like this would be better dealt with using API calls from an ActiveX Control. There may be some shell commands available for use, but I'm not sure.
Select allOpen in new window