Page 1 of 1

Playing sound in HTA across network share

Posted: Wed Feb 16, 2011 3:41 am
by screwloosedan
I accidentally posted this same question in the wrong section yesterday...sorry for cross posting (and the other section doesn't allow me to move or otherwise modify).

I have a need to play a sound from within an HTA. To keep it simple
and so multiple users can use it I would like to 1 - Use a default
windows sound and 2) Be able to run the HTA from a network share.

seemed simple enough, but it doesn't appear to work. A possible work
around includes putting a sound file on the network share, but I wanted
to reduce the chances of someone messing this up.

When running this across a network share I receive no error, but also no sound. If I run this locally, it works as expected (plays sound).

Here's sample code of what I'm trying to do (obviously the real HTA is a bit more involved):

Code: Select all

<title>My HTA</title> 
<!-- ************************* --> 
<script language="vbscript"> 
Sub Window_OnLoad 
    strHtml="<embed src=" & chr(34) & "C:WindowsMediaWindows Ringin.wav" & chr(34) &" autostart=true width=0 height=0 id=" & chr(34) & "alarmsound" & chr(34) & "playcount=" & chr(34) & "10" & chr(34) & " HIDDEN="& chr(34) &"true" & chr(34) & ">" 
    strhtml=strHtml & " 
Message!  You should hear an alarm." 
End Sub 
<!-- ************************* --> 
    <span id="error">&nbsp;</span> 

Playing sound in HTA across network share

Posted: Mon Feb 21, 2011 10:15 pm
by screwloosedan
jvierra - Thanks for the reply and help. Your solution is working much better for me.As a side note "C:WindowsMediaRingin.wav" does not exist on my Vista Enterprise (SP1 32b) build nor my Win 7 Home Premium (64b). "C:WindowsMediaWindows Ringin.wav" does exist on both.