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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert characters at start and end of every RTF line 1

Status
Not open for further replies.

timtom

Programmer
Jul 12, 2001
78
GB
I'm currently doing a lot of ASP->RTF files and my hands are hurting. I have to add a " to the start of every line (and there are sometimes thousands) and a " &_ to the end. Is there anyway I can automate this? I'm using dreamweaver. I am also wasting hours of my working life and tempting the devil to give me severe RSI by this time next week. Cheers dears

Sarah
 
Eg:

<%
Set fs1=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fInput=fs1.OpenTextFile(&quot;input.txt&quot;,1)
Set fs2=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fOutput=fs2.CreateTextFile(&quot;output.txt&quot;)

do while fInput.AtEndOfStream = false
fOutput.writeline( chr(34) & fInput.ReadLine &_
chr(38) &_ chr(95) )
loop
fInput.Close
fOutput.Close
Set fs1=nothing
Set fInput=nothing
Set fs2=nothing
Set fOutput=nothing
%>
br
Gerard
 
BTW:
this action is also possible with my BRIEF editor...
br
Gerard
 
Thanks Foxbox,

I can't quite get it to work though. Keep getting a 500 error. I have the input.txt in the same folder as your page. Do I need anything else on the page and do I need to do anything else? Sorry to be a pain, but if I can get this working it'll be a fantastic help.

Cheers again
Sarah
 
a) You changed my filenames into yours?
b) My sample script has no file existence checking. not sure if the createtextfile will crash if the file already exist (can not test it at the moment)
c) You need write permissions for the output file/ folder
d) it may be necesary (!? most dificult english word for me)
to use add the full path to the files (or use server mappath)

br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top