Computing.Net > Forums > Programming > Batch File Text Modfication?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch File Text Modfication?

Reply to Message Icon

Name: Jixz
Date: January 4, 2009 at 22:02:08 Pacific
OS: Windows Vista
CPU/Ram: 4
Product: Omg / OMGITSOLD
Subcategory: Batch
Comment:

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);



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 5, 2009 at 01:26:10 Pacific
Reply:

@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


0

Response Number 2
Name: Jixz
Date: January 5, 2009 at 14:12:43 Pacific
Reply:

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?


0

Response Number 3
Name: Mechanix2Go
Date: January 5, 2009 at 14:40:09 Pacific
Reply:

@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


0

Response Number 4
Name: Jixz
Date: January 5, 2009 at 14:44:59 Pacific
Reply:

:F Dont know what I did Different.. but it worked? Now could I add Sleep(10); in between each beep?

-- Your God Like -- Thanks --


0

Response Number 5
Name: Mechanix2Go
Date: January 5, 2009 at 15:46:12 Pacific
Reply:

@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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File Text Modfication?

Batch file for text replacement www.computing.net/answers/programming/batch-file-for-text-replacement/12883.html

Find and Replace text in Batch File www.computing.net/answers/programming/find-and-replace-text-in-batch-file/12413.html

Text Input Box in a Batch File www.computing.net/answers/programming/text-input-box-in-a-batch-file/15016.html