How do I turn on sound with a script/batch file? (WinXP Home P3)

F

Fuzzy

What I need is a script/batch file that can turn on / turn off audio,
(as if the speaker icon was muted and un-muted). I have software to
run a program / script / batch file, play a sound file, wake and hibernate
the system. I just need to ensure that sound is not muted when it needs to be
played. The laptop does have fn-f6 as a key combo to do the sound toggle
but I don't know how to emulate the keystroke's.

Anyone have any idea.

Thanks
 
A

Alister

Fuzzy said:
What I need is a script/batch file that can turn on / turn off audio,
(as if the speaker icon was muted and un-muted). I have software to
run a program / script / batch file, play a sound file, wake and hibernate
the system. I just need to ensure that sound is not muted when it needs to be
played. The laptop does have fn-f6 as a key combo to do the sound toggle
but I don't know how to emulate the keystroke's.

Anyone have any idea.

Thanks

Using VBscript you can control the master volume Mute with the following:


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

or (using Hex values)

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

This sends the keycode value used by multimedia keyboards and is a toggle.

HTH

Alister
 
F

Fuzzy

Ok

what do I do (do the lines go in a txt type file like bat and cmd files)?
what extention is used?

what program runs it? cmd.com?
 
F

Fuzzy

never mind... I figured it out.

its like another script program... txt type file with vbs extension.
when ran that, it open a console windows did its thing and exited.
Works exactly as the fn-f6 key does toggle the x on the speaker icon.

thanks :)
 
A

Alister

Fuzzy said:
Ok

what do I do (do the lines go in a txt type file like bat and cmd files)?
what extention is used?

what program runs it? cmd.com?

Create a new text file in notepad, copy those lines into it (Only copy
one set - either the decimal version or the Hex version - it doesn't
matter) and save it as mute.vbs (Note that in notepad it will stick a
..txt on the end unless you save as type "All Files") Save it to
somewhere where you can find it - either on your desktop or in the root
of C:\ If you saved it to the desktop then double-clicking it will run
it. If you want to run it programaticaly then you can set it as a
scheduled task or run it from within a batch file. You said you already
had some software to run a batch file, so you should be able to call it
direct from there.

Alister
 
A

Alister

Fuzzy said:
never mind... I figured it out.

its like another script program... txt type file with vbs extension.
when ran that, it open a console windows did its thing and exited.
Works exactly as the fn-f6 key does toggle the x on the speaker icon.

thanks :)

No problem.

The only difficulty is it just toggles Mute on or off - there is, to my
knowledge, no way of checking whether the sound is muted in VB script.
So you would have to know in advance which way it is set.

Alister
 
F

Fuzzy

Where can find doc on what that script language supports?

it seems kinda like the various different unix type shells
which would be very helpful since command.com and
cmd.com don't do a whole lot that way.

thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top