How to play WAV file using VBScript in HTML?
I have got following code but it is not working.
<script type="text/vbscript" language="VBScript">
Dim strSoundFile, strCommand
strSoundFile = "C:\Sounds\Sound1.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, True
</script>
I found another code but it doesnt work as well if I use it in HTML page but it is working great in a *.VBS.
Sub Play(SoundFile)
Dim Sound
Set Sound = CreateObject("WMPlayer.OCX")
Sound.URL = SoundFile
Sound.settings.volume = 100
Sound.Controls.play
do while Sound.currentmedia.duration = 0
wscript.sleep 100
loop
wscript.sleep(int(Sound.currentmedia.duration)+1)*1000
End Sub
I have found this link https://support.microsoft.com/es-es/kb/279022 but I am not shure if it is a correct way...
The way is working fine via in BODY
tag is following
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer"
width="242" height="202" style="position:absolute; left:1;top:1;">
<param name="URL" value="C:\Sound1.wav">
<param name="autoStart" value="1">
</object>
Could it be done using this?
<script type="text/vbscript" language="VBScript"> HERE </script>
I am using IE8 under MS Windows 7 Pro.