Adam Shelly
11/9/2006 7:55:00 PM
On 11/9/06, Peter Bailey <pbailey@bna.com> wrote:
> Hello,
> Can someone help me diagnose what's going on with my script?
>....
> it adds it hundreds and hundreds of times, not just one time,
> which is all I want.
> ...
I think the problem is probably this line:
file_contents.gsub!(/.*$/, "\%\%Blank page for Asura.\n\%\%Page:
#{totalpages.to_i}\nshowpage\n")
You are replacing evevery single line in file_contents with the
"blank page" string
So you will add as many strings as you have lines in the original file.
If I understand what you are asking, I don't think you need the gsub
at all. If you want to append that string to the end, just do:
File.open("#{$psfile}", "a") { |f| f.print "\%\%Blank page for
Asura.\n\%\%Page:
#{totalpages.to_i}\nshowpage\n"}