# Programmers, XP Experts, I Have a Problem.

**URL:** <https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684>\
**Category:** Factual Questions\
**Created:** [October 19, 2013, 10:26pm UTC](https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684 "2013-10-19T22:26:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsutter](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jsutter](https://boards.straightdope.com/u/jsutter)\
**Post date:** [October 19, 2013, 10:26pm UTC](https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684/1 "2013-10-19T22:26:44Z")

</div>

In a directory Base, I have 01-09.map files. I wish to batch a common change in each and end up with 2 folders, Base and Base-changed.

Map files can be read as text by changing .map to .txt. These files are readable but cannot be edited.

For example, 09.map  
Time 310  
ColorCount 5  
Colors 1 2 5 6 7  
Field 8x10  
— --- c1 x5 x6 c1 — ---  
w1 w1 c1 c1 c1 c1 w1 w1  
w1 w1 c1 a28 c1 c1 w1 w1  
w1 w1 c1 c1 a29 x2 w1 w1  
w1 w1 c1 c1 c1 c1 w1 w1  
w1 w1 x5 c1 c1 x2 w1 w1  
w1 w1 c1 c1 c1 c1 w1 w1  
w1 w1 c1 c1 c1 a30 w1 w1  
w1 w1 x5 c1 c1 x7 w1 w1  
— --- x7 b8 c1 x5 — ---

I want to change the Time values in all to 6000. Some macro batcher?

Aloha

---

<div class="post-metadata">

**Author:** ![Mithras](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Mithras](https://boards.straightdope.com/u/Mithras)\
**Post date:** [October 19, 2013, 11:42pm UTC](https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684/2 "2013-10-19T23:42:54Z")

</div>

This isn’t the most extensible piece of code, but it should do exactly what you described. You just need to change the input and output directories. Save the following to a file with an extension of ‘vbs’ and run it by typing:

cscript yourfile.vbs

> [@](#):
>
> For i = 1 to 9  
> Set fileSys = CreateObject(“Scripting.FileSystemObject”)  
> Set inFile = fileSys.OpenTextFile(“C:\input\_directory\0” + CStr(i) + “.map”)  
> Set outFile = fileSys.CreateTextFile(“C:\output\_directory\0” + CStr(i) + “.map”)  
> Do Until inFile.AtEndOfStream  
> line = inFile.ReadLine  
> If InStr(line,“Time”)\> 0 Then  
> line = “Time 6000”  
> End If  
> outFile.WriteLine(line)  
> Loop  
> inFile.Close  
> outFile.Close  
> Next

---

<div class="post-metadata">

**Author:** ![jsutter](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jsutter](https://boards.straightdope.com/u/jsutter)\
**Post date:** [October 20, 2013, 2:01am UTC](https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684/3 "2013-10-20T02:01:35Z")

</div>

Stay tuned. Mahalo and Aloha

---

<div class="post-metadata">

**Author:** ![jsutter](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jsutter](https://boards.straightdope.com/u/jsutter)\
**Post date:** [October 20, 2013, 5:17am UTC](https://boards.straightdope.com/t/programmers-xp-experts-i-have-a-problem/671684/4 "2013-10-20T05:17:43Z")

</div>

Like a charm. Looks pretty extensible to me. Thanks so much. Aloha
