Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Play Sound

Status
Not open for further replies.

infojens

Programmer
Joined
Jul 31, 2001
Messages
3
Location
DK
How can I play a wav sound in vbscript ?
 

infojens,

I don't have the script code for media player, but this works from an IE browser.

fengshui1998

<HTML>
<HEAD><TITLE>Windows Media Player Test</TITLE></HEAD>
<BODY>

<OBJECT ID=&quot;MediaPlayer1&quot; WIDTH=320 HEIGHT=240
CLASSID=&quot;CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95&quot;
STANDBY=&quot;Loading Windows Media Player components...&quot;
TYPE=&quot;application/x-oleobject&quot;>

<PARAM NAME=&quot;FileName&quot; VALUE=&quot;D:\EJ\Circle Of Life.mp3&quot;>
<PARAM NAME=&quot;ShowControls&quot; VALUE=&quot;False&quot;>
<PARAM NAME=&quot;AutoRewind&quot; VALUE=&quot;True&quot;>
<PARAM NAME=&quot;AutoStart&quot; VALUE=&quot;False&quot;>
</OBJECT>

<BR>
<INPUT TYPE=&quot;BUTTON&quot; NAME=&quot;BtnPlay&quot; VALUE=&quot;Play&quot;>
<INPUT TYPE=&quot;BUTTON&quot; NAME=&quot;BtnStop&quot; VALUE=&quot;Stop&quot;>
<INPUT TYPE=&quot;BUTTON&quot; NAME=&quot;BtnAbout&quot; VALUE=&quot;About&quot;>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub BtnAbout_OnClick
MediaPlayer1.AboutBox
End Sub

Sub BtnPlay_OnClick
MediaPlayer1.Play
End Sub

Sub BtnStop_OnClick
MediaPlayer1.Stop
MediaPlayer1.CurrentPosition = 0
End Sub
-->
</SCRIPT>

</BODY>
</HTML>
 
You can also just use the <Embed> Tag within the <body> tag to play just one sound. This also works with MIDI and MPEG.

<embed src=&quot;SomeFile.wav&quot; hidden>

Hope this helps.

Tazzmann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top