有没有办法在VBS中打开声音而没有对话?
这是我的代码......
intAnswer = _
Msgbox("Do you want to play welcome.mp3?", _
vbYesNo, "Play Song?")
If intAnswer = vbYes Then
Msgbox "Opening..."
`play %userprofile%/directory/welcome.mp3 with no dialogue`
Else
Msgbox "Not opening..."
End If
答案 0 :(得分:10)
您可以使用Windows Media Player脚本对象WMPlayer.OCX
在VBScript中播放MP3文件。
Dim oPlayer
Set oPlayer = CreateObject("WMPlayer.OCX")
' Play audio
oPlayer.URL = "C:\welcome.mp3"
oPlayer.controls.play
While oPlayer.playState <> 1 ' 1 = Stopped
WScript.Sleep 100
Wend
' Release the audio file
oPlayer.close