TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on September 19, 2008, 11:16:06 AM
-
Hi all,..
I'm curious to see your code to play wav file.
ther's mine.
(defun PlayWav (wavfile / WAV)
(vl-load-com)
(setq WAV (vlax-create-object "Wscript.Shell"))
(vlax-invoke
WAV
"run"
(strcat "sndrec32 /play /close \"\" " wavfile) T)
(vlax-release-object WAV)
)
(playwav "c:\\windows\\media\\tada.wav")
-
I think I can use this somewhere....
-
(defun ARCH:assWAV () (dos_wav (strcat ARCH#SUPF "gerbil_ass.wav")))
(defun ARCH:dumassWAV ()
(dos_wav (strcat ARCH#SUPF "frog_dumbass.wav")))
(defun ARCH:lookinWAV () (dos_wav (strcat ARCH#SUPF "frog_lookin.wav")))
-
Andrea,
That's the code route I'd take too.
Here's a different version that won't error if the wav file is not found.
(defun playwav (wavfile / WAV)
(vl-load-com)
(if (and (findfile wavfile)
(= (strcase (vl-filename-extension wavfile)) ".WAV")
(setq WAV (vlax-create-object "Wscript.Shell"))
)
(progn
(vlax-invoke
WAV
"run"
(strcat "sndrec32 /play /close \"\" " wavfile)
T
)
(vlax-release-object WAV)
)
)
)
-
nice catch ronjonp ! :-)
-
Dear Andrea and Ronjonp,
The sndrec32 command does not seem to be available in Vista.
Is there an equivalent
I can use in Vista??
Greetings.
-
Dear Andrea and Ronjonp,
The sndrec32 command does not seem to be available in Vista.
Is there an equivalent
I can use in Vista??
Greetings.
From what I've read, the easiest solution is to copy the sndrec32.exe from an XP computer to your Vista computer %windir%\System32.
-
There are more examples here:
http://www.theswamp.org/index.php?topic=14549.0
-
These don't work anymore. Anyone have an idea why?
Does "Wscript.Shell" work differently now perhaps?