Ruggershawn wrote:
> Hello,
> 
> I am fairly new in the ruby language.  I have a ruby program that
> needs to be automated.  Every time I run this program you have to
> manually type in the questions.
> 
> Examples:  Are you using 32/64 bit?
>                   Enter the path where you wish to install?
> 
> What I am trying to find a way where I can create a script to pipe the
> answers from a flat file so this can be done automatically.
> 
> Anyone have any ideas?
> 
> Thanks!

This works too:

#original program: r1test.rb

puts "Enter 32 or 64 bit:"
answer1 = gets.strip.chomp

puts "Enter the path where you wish to install:"
answer2 = gets.strip.chomp

File.open('output.txt', 'w') do |f|
  f.puts("Your answers were:")
  f.puts answer1
  f.puts answer2
end

Just be aware that popen() hijacks stdin and stdout in the original 
program--directing the original program's input and output to the IO 
object created in the driver program.  If your original program writes 
some results to a file, then that won't be an issue.
-- 
Posted via http://www.ruby-forum.com/.