' ********************************************************************* ' ' Name : PlayWAV.vbs ' Author : 3Ds (UK) Limited ' Description : Example VBScript to play a WAV file when a Sentry-go ' alert is triggered. Reference this file for the alert ' group(s) required within the monitor's configuration. ' ' Arguments : None. ' ' WIZARD:PARAMS=This script requires no parameters ' WIZARD:PARAMEXAMPLE= ' ' Returns : 0 - Success ' 1 - An error occurred. ' ' WIZARD:RESULTS=Return code ...||0 = OK|1 = An error prevented the script from running.||Script output also indicates "OK" for success, or "Error" with details of the faults found. ' ' Notes : Requires Windows Scripting Host (for VBScript). Should ' be called from Sentry-go as an Alert Engine file in ' order to expand the error-specific place-markers. ' ' Sound must be enabled on the target PC/server! ' ' Change the "TODOs" for your own requirements. ' ' ********************************************************************* ' Enable in-line error handling On Error Resume Next ' ------ Local declarations ------ Dim objShell ' Shell reference Dim strWAVFile ' Our WAV file Dim strCommand ' Commnand to run ' ------ Main Logic ------ ' TODO: Set the path & name of the WAV file to play strWAVFile = "Path/YourWAVFile" ' Access the shell Set objShell = CreateObject("Wscript.Shell") If Err.Number <> 0 Then ' Error WScript.Echo "Error. Unable to create the shell object. " & Err.Description WScript.Quit(1) End If ' Create the command line strCommand = "sndrec32 /play /close " & chr(34) & strWAVFile & chr(34) ' Run it objShell.Run strCommand, 0, False If Err.Number <> 0 Then ' Error Set objShell = Nothing WScript.Echo "Error. Unable to play the WAV file " & strWAVFile & ". " & Err.Description WScript.Quit(1) End If WScript.Sleep 1000 ' All OK Set objShell = Nothing WScript.Echo "OK. The WAV file was played successfully" WScript.Quit (0) ' ------ End of Script ------