HI!

the current code which I am using is (also attached):

-------Dump_Collect.rb--------
require 'rbdi'
require 'net/telnet'

HERE = File.dirname(File.expand_path(__FILE__))

bdi = RBDI.new({'Host'  => 'bdiemul'})
bdi.quiet = false

bdi.send_1 <<-LOAD_SCRIPT
re
ci
bi 0x00002e04
go
LOAD_SCRIPT


for k in 1..250

bdi.send_1 <<-LOAD_SCRIPT
dump 0x003f72e0 128 
C:/EBAC_VnV/CCA/PBLSP/Results/Dump/Discrete_Services/atl_#{k}.dat
go
LOAD_SCRIPT

end

sleep 1

------------------------
--------rbdi.rb-------
require 'net/telnet'

class RBDI

  attr_accessor :quiet

  def initialize(options)
    @prompt = /BDI>/
    @quiet = options['Quiet']
    @quiet = true if @quiet.nil?

    @connection = Net::Telnet.new({'Host'   => options['Host'],
                                   'Prompt' => @prompt}) {|str| print 
str unless @quiet}

    # consume the initial display of help
    @connection.waitfor(@prompt) {|str| print str unless @quiet}
  end

  # Send a script of commands to the BDI
  # If script is a filename, the commands will be read from the file.
  # The Quiet option specified at creating may be overruled for this 
script.
  def send(script, options={'Quiet' => @quiet})
    script = File.new(script) if FileTest.file? script

    begin
      script.each_line do |command|
        @connection.cmd({'String' => command.strip}.merge(options)) do 
|str|
          print str unless str.nil? or options['Quiet']
        end
      end
    rescue Errno::ECONNRESET, Errno::ECONNABORTED
      puts "Connection closed" unless options['Quiet']
      return
    end
  end

end
--------------------------------

I am looking at bdi.send_1 to send instructions when the @promt is /-- 
Target stopped/. I need to add a procedure in rbdi.rb for send_1 which 
sends commands @prompt /-- Target stopped/, and I am unable to do this.

Amogh.

Attachments:
http://www.ruby-forum.com/attachment/3897/ruby.zip

-- 
Posted via http://www.ruby-forum.com/.