Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add semi-colon to lines of text file via inputbox

Status
Not open for further replies.

Nu2Java

Technical User
Jun 5, 2012
166
0
0
US
Hi.. I have a text file that is used to control a machine. From time to time, I need to edit the file to remove some functions in the machine program. What I need is to be able to add a semicolon to the controls in the program and then reverse this action when I am finished, since the changes will be temporary. I have found scripts to enter something in the beginning of the line, but not like what I need to do. The file structure looks like this:

Code:
N0001 (D12)
N0002 X -0.987 Y 0.348
N0003 Z -0.725
N0004 G01 F7.000
N0005 (D13)
N0006 X -0.239 Y 0.212
N0007 Z -0.725
N0008 G01 F7.000

So, this is how the original file will look. In brackets (D12) is the operation of which I want to skip, so I need to place a semicolon after each "N" Number like so, until I get to the next operation.

To Skip (D12) =
Code:
N0001 ;(D12)
N0002 ;X -0.987 Y 0.348
N0003 ;Z -0.725
N0004 ;G01 F7.000

What I would like to be able to do is have an Inputbox to ask "Enter an Operation to Skip" and enter (D12) to place the semicolon where needed, which will be in all lines until the next set of brackets. Any help on this would be great! Thanks
 
Ahh, now I see it. Thanks a lot! It works great now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top