Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Play a wav file

Posted by on Sunday, January 18, 2004 (PST)

Play a wav file using the MCI Multimedia Control.

/**
 *    Script:   PlaySound.js
 *    Purpose:  Plays a wav file
 *    Author:   Daren Thiel
 *    Date:     22 November 1998
 *
 *    Note:     rename this file PlaySound.js
 *    Web:     
http://www.winscripter.com
 **/
/* Create MCI MultiMedia Control */
sound = new ActiveXObject("MCI.MMcontrol");
/* Select the wav file to play */
sound.FileName = "c:\\windows\\media\\The Microsoft Sound.wav";
/* Set the control to auto */
sound.AutoEnable = true;
/* Issue Commands */
sound.Command = "Open";
sound.Command = "Play";
/* Necessary to keep WSH from closing before sound completes */
WScript.Echo("Playing");
 
 

 


Add Your Comment



WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.


  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon