I want to use a script to monitor current events on a central monitoring server. When a problem is reported to the central monitoring server, I'd like the script to alert me with an audible alarm. Can I play a .wav file from within a VBScript file run from Windows Script Host's (WSH's) CScript host? If so, how do I script it?
You can play a .wav file; the code in Listing 1 shows how. This code uses the Windows Sound Recorder program to play the Windows XP Exclamation.wav file. The code creates an instance of WSH's WshShell object and calls the object's Run method, which takes three arguments. The first argument is the Sndrec32 program, which launches the Sound Recorder, plays the exclamation.wav file, then closes the program. The second argument is an integer value that specifies the appearance of the program's window. A value of 0 prevents the Sound Recorder window from being displayed. The last argument is a Boolean value that you can use to specify whether the script should wait for the specified command to finish executing before continuing to the next statement. In this case, by setting the value to True, you're telling the script to stop executing until the Sndrec32 program finishes. . . .

