Torgeir
Mon May 03 14:28:36 CDT 2004
Buckwheat wrote:
> It is a performance issue in the sense that it takes 2-4 seconds from the
> time the respective section of code is triggered to when the sound actually
> begins playing. The fact that the code is instantiating an instance of the
> object leads me to believe that, like in UNIX/LINUX, a new instance of the
> shell is being created, and thus, there is unnecessary overhead causing the
> delay. I need a method which will play the sound instantly.
Hi
I would think that delay is cased by the startup of the
media player, and not the shell.
If a beep (or a series of beeps) is good enough, this
might work better for you:
Set oShell = CreateObject("Wscript.Shell")
MsgBox "one Beep"
' one Beep
'Beep 1, 0
MsgBox "3 beeps with a very short pause between each"
' 3 beeps with a very short pause between each
Beep 3, 2
MsgBox "3 beeps with a longer pause between each"
' 3 beeps with a longer pause between each
Beep 3, 4
Sub Beep(n, wait)
For i = 1 To n
oShell.Run "%comspec% /c echo "&Chr(7), 0, False
Wscript.Sleep wait*100
Next
End Sub
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx