Batch File Text Modfication?

Omg / OMGITSOLD
January 4, 2009 at 22:02:08
Specs: Windows Vista, 4
Mmk.. BASICLY i need a text file that will convert this:
Note 288 600ms T2 C1 42units 87ms d4 Vel77
Note 336 700ms T2 C1 42units 87ms d4 Vel75
Note 672 1400ms T2 C1 42units 87ms d4 Vel77
Note 720 1500ms T2 C1 42units 87ms d4 Vel75
Note 768 1600ms T2 C1 85units 177ms d4 Vel79
Note 864 1800ms T2 C1 85units 177ms b3 Vel88
Note 960 2000ms T2 C1 85units 177ms g3 Vel85
Note 1056 2200ms T2 C1 85units 177ms b3 Vel106
Note 1152 2400ms T2 C1 85units 177ms d4 Vel73
Note 1248 2600ms T2 C1 85units 177ms b3 Vel84
Note 1344 2800ms T2 C1 85units 177ms d4 Vel67
Note 1440 3000ms T2 C1 85units 177ms g4 Vel82

Into this:

Beep(d4,87);
Beep(d4,87);
Beep(d4,87);
Beep(d4,87);
Beep(d4,177);
Beep(b3,177);
Beep(g3,177);
Beep(b3,177);
Beep(d4,177);
Beep(b3,177);
Beep(d4,177);
Beep(g4,177);

Any Ideas??
I want this script to be able to have the input script change up and it still output the Beep( The Second To Last Column Value, The Third To Last Column Value);


See More: Batch File Text Modfication?

Report •


#1
January 5, 2009 at 01:26:10
@echo off > newfile & setLocal EnableDelayedExpansion

for /f "tokens=7-8 delims= " %%a in (myfile) do (
set N=%%a
set N=!N:ms=!
echo Beep(%%b,!N!^);>> newfile
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
January 5, 2009 at 14:12:43
Hmm.. I try this, it just makes a new empty file.. I input "input.txt" for myfile
and output.txt for newfile.. and I cant really seem to get this to work. Could you explain whats going on so i can maybe adapt it?

Report •

#3
January 5, 2009 at 14:40:09
@echo off > output.txt & setLocal EnableDelayedExpansion

for /f "tokens=7-8 delims= " %%a in (input.txt) do (
set N=%%a
set N=!N:ms=!
echo Beep(%%b,!N!^);>> output.txt
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
January 5, 2009 at 14:44:59
:F Dont know what I did Different.. but it worked? Now could I add Sleep(10); in between each beep?

-- Your God Like -- Thanks --


Report •

#5
January 5, 2009 at 15:46:12
@echo off > output.txt & setLocal EnableDelayedExpansion

for /f "tokens=7-8 delims= " %%a in (input.txt) do (
set N=%%a
set N=!N:ms=!
echo Beep(%%b,!N!^);>> output.txt
echo Sleep(10^);>> output.txt
)


=====================================
If at first you don't succeed, you're about average.

M2


Report •


Ask Question