You are looking for some kind of interactive script. I can't imagine its too 
hard to do, but I don't have much time to mess around with it. Heres a fun 
little script i put together to test out an idea. Maybe it will spark some 
ideas.

(note: do not use this for anything, its just for fun. Also, 'gets' blocks all 
threads, so it doesn't even work right. Enjoy :) )

class Console_Test
        def run
                done = false
                
                while !done
                        input_string = gets.chomp!
                
                        if input_string == 'wait'
                                puts '*sleeping*'
                                sleep 5
                                puts '*awake*'
                        end
                        
                        if input_string == 'done'
                                done = true
                                puts '*done*'
                        end
                end
        end
end

class Testing
        def run
                done = false
                i = 1
                while !done
                        puts 'Current: ' + i.to_s
                        sleep 1
                        i += 1
                                                
                        if i > 10
                                done = true
                        end
                end
        end
end


test = Testing.new()
console = Console_Test.new()

threads = []
threads << Thread.new{ console.run() }
threads << Thread.new{ test.run() }

threads.each {|t| t.join }
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6704&messageID=19346#19346
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to