D
David Trimboli
I'm trying to create a batch file that will cycle sound files - for
instance, changing the e-mail sound every time someone logs in.
Here's the script so far:
:-------------------------
REM @echo off
setlocal enableextensions
set sounddir=c:\sounds
set soundchosen=no
for /f "tokens=*" %%i in (%sounddir%\soundindex.txt) do (
if %soundchosen% equ no (
copy /y %sounddir%\%%i %sounddir%\mysound.wav
set lastsound=%%i
set soundchosen=yes
) else (
copy /y soundindex.tmp soundindex.txt
del soundindex.tmp
:-------------------------
In %sounddir% there are a series of .wav files. soundindex.txt contains a
list of all the .wav files in %sounddir%. The script is supposed to take
the first name on the list, copy the corresponding sound to
%sounddir%\mysound.wav, then rewrite the list, putting the new sound at the
bottom of the list. %sounddir%\mysound.wav will be the file the event is
set to. Here's the output I get when I run the script:
:-------------------------
C:\Sounds>sounds
C:\Sounds>REM @echo off
C:\Sounds>setlocal enableextensions
C:\Sounds>set sounddir=c:\sounds
C:\Sounds>set soundchosen=no
C:\Sounds>
C:\Sounds>
:-------------------------
Here are some sample files and the index file that cause this to happen:
-------------------------
C:\sounds>dir
Volume in drive C is System
Volume Serial Number is 103F-22AB
Directory of C:\sounds
05/24/2004 10:11a <DIR> .
05/24/2004 10:11a <DIR> ..
06/20/2003 08:00a 15,906 ir_begin.wav
06/20/2003 08:00a 42,728 ir_end.wav
06/20/2003 08:00a 75,508 ir_inter.wav
05/24/2004 10:11a 38 soundindex.txt
4 File(s) 134,180 bytes
2 Dir(s) 31,126,949,888 bytes free
C:\sounds>type soundindex.txt
ir_begin.wav
ir_end.wav
ir_inter.wav
C:\sounds>
-------------------------
Can someone tell me why this script stops at the FOR statement?
David
Stardate 4395.8
instance, changing the e-mail sound every time someone logs in.
Here's the script so far:
:-------------------------
REM @echo off
setlocal enableextensions
set sounddir=c:\sounds
set soundchosen=no
for /f "tokens=*" %%i in (%sounddir%\soundindex.txt) do (
if %soundchosen% equ no (
copy /y %sounddir%\%%i %sounddir%\mysound.wav
set lastsound=%%i
set soundchosen=yes
) else (
copy /y soundindex.tmp soundindex.txt
del soundindex.tmp
:-------------------------
In %sounddir% there are a series of .wav files. soundindex.txt contains a
list of all the .wav files in %sounddir%. The script is supposed to take
the first name on the list, copy the corresponding sound to
%sounddir%\mysound.wav, then rewrite the list, putting the new sound at the
bottom of the list. %sounddir%\mysound.wav will be the file the event is
set to. Here's the output I get when I run the script:
:-------------------------
C:\Sounds>sounds
C:\Sounds>REM @echo off
C:\Sounds>setlocal enableextensions
C:\Sounds>set sounddir=c:\sounds
C:\Sounds>set soundchosen=no
C:\Sounds>
C:\Sounds>
:-------------------------
Here are some sample files and the index file that cause this to happen:
-------------------------
C:\sounds>dir
Volume in drive C is System
Volume Serial Number is 103F-22AB
Directory of C:\sounds
05/24/2004 10:11a <DIR> .
05/24/2004 10:11a <DIR> ..
06/20/2003 08:00a 15,906 ir_begin.wav
06/20/2003 08:00a 42,728 ir_end.wav
06/20/2003 08:00a 75,508 ir_inter.wav
05/24/2004 10:11a 38 soundindex.txt
4 File(s) 134,180 bytes
2 Dir(s) 31,126,949,888 bytes free
C:\sounds>type soundindex.txt
ir_begin.wav
ir_end.wav
ir_inter.wav
C:\sounds>
-------------------------
Can someone tell me why this script stops at the FOR statement?
David
Stardate 4395.8