Posted by Darren | Posted in Programming | Posted on 10-09-2007
0
Instead of using VBScript to maximize and unmute the volume, I thought I might use AutoIt. But when looking for a script to do the job in AutoIt, I stumbled across the program AutoHotkey. AutoHotkey makes the job a lot easier and doesn’t open up the volume dialog (although that’s funny). AutoHotkey also allows you to compile the script to an executable file (.exe), just like AutoIt. Here is the AutoHotkey code:
Send {Volume_Mute}
SoundSet, 100
SoundSet, 100, WAVE
SoundSet, 100, SYNTH
SoundSet, 100, CD
SoundSet, 100, MICROPHONE
SoundSet, 100, LINESoundPlay, C:\WINDOWS\Media\notify.wav, WAIT
Posted by Darren | Posted in Programming | Posted on 10-08-2007
0
I’ve never played around much with VBScript, but it’s pretty neat. Rusty was showing me some code he did after reading this TechEBlog article. We thought it would be funny to write a script that unmuted, maxed the volume, and played a sound file. Here is the VBScript I came up with (save as .vbs):
set oshell=createobject(“wscript.shell”)
oshell.run “sndvol32″
oshell.appactivate “volume control”
WScript.sleep 600
oshell.appactivate “volume control”
oshell.sendkeys “{tab}”
wscript.sleep 600
For X = 1 To 500
oshell.sendkeys “^{UP}”
oshell.appactivate “volume control”
Next
wscript.sleep 600
oshell.sendkeys “m”
wscript.sleep 600
oshell.sendkeys Chr(32)
wscript.sleep 600
oshell.appactivate “volume control”
wscript.sleep 600
oshell.sendkeys “%{f4}”strSoundFile = “C:\WINDOWS\Media\notify.wav”
Set objShell = CreateObject(“Wscript.Shell”)
strCommand = “sndrec32 /play /close ” & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, False
Wscript.Sleep 1000
Continue = MsgBox (“Message Box Message”, vbYesNo, “Message Box Title”)
Here is the batch file to copy files to computer (save as .bat):
@echo off
xcopy /Y “sound.vbs” “c:\temp\”
xcopy /Y “sound.ico” “c:\temp\”
xcopy /Y “sound.lnk” “%USERPROFILE%\Desktop”