I have a simple script here where I am just matching two inputbox values. I am playing a buzzer sound with windows media player if they do not match and then I am attempting to kill the player after it plays and then return to my script. I have tried putting the task kill in several spots but with no luck. If I kill it manually, my script comes back as it should. Any thoughts?
Code:
Dim PartA, PartB
set WshShell = CreateObject("WScript.Shell")
Scan = True
Do While Scan
PartA = UCase(InputBox("Scan Part Number Barcode on REEL: "))
PartB = UCase(InputBox("Scan Part Number Barcode on BIN: "))
If PartA = PartB Then
WshShell.Run "%comspec% /c echo " & Chr(7), 0, False
Wscript.Sleep 300
Else
Scan = False
music = "C:\Scripts\DoorBuzzer.mp3"
WshShell.Run "wmplayer """ & music & """",0,True
Wscript.Sleep 2500
WshShell.Run "taskkill /f /im wmplayer.exe", 0, True
Scan = True
End If
Loop