如何在 HTML 中使用VBScript播放WAV文件?
我有以下代码,但无法正常工作。
<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>
我找到了另一个代码,但是如果我在HTML页面中使用它,它也不会正常工作,但是在* .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
我已经找到此链接https://support.microsoft.com/es-es/kb/279022
但我不确定这是否是正确的方法...
通过
BODY
标签的方式可以正常工作<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>
可以用这个做吗?
<script type="text/vbscript" language="VBScript"> HERE </script>
我正在MS Windows 7 Pro下使用IE8。
最佳答案
最后我可以找到正确的方法来做我所需要的描述here
基本上这个想法是跟随
关于audio - 如何在HTML中使用VBScript播放WAV文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33897689/