From: Ziabuch on
Hello :)


It is my first time on this newsgroup, I hope I will find some help here.

My boss asked me if I would be able to do the following task. Well, I am
unable to do it, but I wonder if it is easy for a decent VBScript
programmer to accomplish.

Although it has not to be written in VBScript, it was the first thing on
my mind, because it can be run on any Windows XP machine without
installing additional software. Tell me what you guys think. Is it a
good choice for doing such a task?


I hope I got the following algorithm right, since I am not a
programmer... Well, I was once, but it was over 20 years ago.


The steps the script should follow:


1. Read the text file FILENAME.txt (the best way to do it is the message
box with 'browse' button)

(filename is a random name from the disk) which has the following content:



001 1032 2933 4921244
002 24032 1022 2091123
003 3004 2000 2001123
004 133094 2000 2001000



2. If (the digit in 7th column equals 1, 3 or 4)

AND

(the character at the 6th column equals a space
- in other words - if the number in the 2nd group of digits
consists of 4 digits)

change the 20th digit to 3 and proceed to the next line.



3. When there are no lines left, write the new content to the text file
FILENAME_c.txt.



The new content of the FILENAME_c.txt should look like this:

001 1032 2933 4923244
002 24032 1022 2091123
003 3004 2000 2003123
004 133094 2000 2001000

As you can see, only lines 1 and 3 were altered (1 changed to 3 in 20th
column).

Could you give me some examples how to accomplish it in VBScript?

The text filename on the disk has many lines and it is average of 200KB.



Thanks for any support :)
Z.

From: Mayayana on
This is a newsgroup for sharing advice and help.
If you want someone to write your script then you
need to offer someone payment. If you want to try it
yourself then you can write the basics and ask here
for specific help.

The scripting help files are here:

http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9

FileSystemObject deals with file I/O. Textstream is
the object for reading/writing files. Most of what you
want to do is fairly simple string operations and
file operations, but if you want to have a "browse
button" that gets more involved. VBScript does not
have any native GUI except a simple message box or
input box.

|
| It is my first time on this newsgroup, I hope I will find some help here.
|
| My boss asked me if I would be able to do the following task. Well, I am
| unable to do it, but I wonder if it is easy for a decent VBScript
| programmer to accomplish.
|
| Although it has not to be written in VBScript, it was the first thing on
| my mind, because it can be run on any Windows XP machine without
| installing additional software. Tell me what you guys think. Is it a
| good choice for doing such a task?
|
|
| I hope I got the following algorithm right, since I am not a
| programmer... Well, I was once, but it was over 20 years ago.
|
|
| The steps the script should follow:
|
|
| 1. Read the text file FILENAME.txt (the best way to do it is the message
| box with 'browse' button)
|
| (filename is a random name from the disk) which has the following content:
|
|
|
| 001 1032 2933 4921244
| 002 24032 1022 2091123
| 003 3004 2000 2001123
| 004 133094 2000 2001000
|
|
|
| 2. If (the digit in 7th column equals 1, 3 or 4)
|
| AND
|
| (the character at the 6th column equals a space
| - in other words - if the number in the 2nd group of digits
| consists of 4 digits)
|
| change the 20th digit to 3 and proceed to the next line.
|
|
|
| 3. When there are no lines left, write the new content to the text file
| FILENAME_c.txt.
|
|
|
| The new content of the FILENAME_c.txt should look like this:
|
| 001 1032 2933 4923244
| 002 24032 1022 2091123
| 003 3004 2000 2003123
| 004 133094 2000 2001000
|
| As you can see, only lines 1 and 3 were altered (1 changed to 3 in 20th
| column).
|
| Could you give me some examples how to accomplish it in VBScript?
|
| The text filename on the disk has many lines and it is average of 200KB.
|
|
|
| Thanks for any support :)
| Z.
|