# method to open new gutenberg window def rungutenbergwindow rwdgutenbergwindowtwo end $tempnumber = 0 # display text and advance text def rwdgutenbergwindowtwo tempdoc = "" @gutendisplayvariable = "" tempcount = 0 if @rwd_tab== "rwdgutenberg" @rwd_window = "gutendisplaywindowtwo" end if $gutenbergcommand == "openbook" tmpfileName = @a_viewgutenberg + ".gut" fileName = File.join($rwdgutenberg_directory,tmpfileName) begin fd = File.open(fileName,"r") booktitle = fd.readline.chomp $stderr.print booktitle $bookfile=File.new(booktitle,"r") #opens the file thats in fileName as read only rescue $stderr.print "error: #{$!}" end $gutenbergcommand == "continue" end if $gutenbergcommand == "continue" tempcount = 0 while tempcount < $booksteps tempdoc += $bookfile.gets #reads the file into the doc string tempcount += 1 end $booklocation = $booklocation + $booksteps end if $gutenbergcommand == "openbook" while tempcount < $booklocation + $booksteps tempdoc += $bookfile.gets #reads the file into the doc string tempcount += 1 end $booklocation = $booksteps $gutenbergcommand = "continue" end if $gutenbergcommand == "closebook" $bookfile.close end @gutendisplayvariable = tempdoc end