From: Robert Klemme Date: 2010-08-24T22:22:02+09:00 Subject: Re: Interacting with other programs 2010/8/24 Jeppe Jakobsen : > Is it possible to make some kind of program hook in ruby, so I can have > the program in question send it's calls to my ruby script first, and > then have ruby forward them to the program? > > If so, please throw me a link where I can read on the subject. Tried to > look into some win32API docs, but didnīt find what I was looking for. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/66884 You can also use #expect from the standard lib: require 'expect' IO.popen "your command", "r+" do |io| prompt_seen = false io.expect ">", 100 do |line| prompt_seen = true printf "Got prompt: %p\n", line end puts "no prompt in time!" unless prompt_seen io.puts "exit" # for shells and other interactive programs io.close_write end The code is untested but should get you going into the right direction. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/