Created
December 25, 2015 09:21
-
-
Save nasitra/ccf751825ce83e7613e6 to your computer and use it in GitHub Desktop.
Play a sound file in Windows Media Player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set objParm = Wscript.Arguments | |
If objParm.Count < 1 Then | |
WScript.Echo "play.vbs [path]" | |
WScript.Quit | |
End If | |
Set wmp = WScript.CreateObject("WMPlayer.OCX") | |
Sub waitWMPlayerStop() | |
Do | |
WScript.sleep(100) | |
Loop Until wmp.playState = 1 | |
End Sub | |
Sub play(path) | |
wmp.URL = path | |
wmp.Controls.currentPosition = 0 | |
wmp.Controls.play() | |
waitWMPlayerStop | |
End Sub | |
wmp.settings.volume = 100 | |
play objParm(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment