From: Heesob Park Date: 2010-07-14T18:03:35+09:00 Subject: Re: gets() -- Need to skip when no response after 20seconds Hi, 2010/7/14 Raveendran .P : > Hi Park, > >> If you try the code with Ruby 1.9.1 >> (http://rubyforge.org/frs/download.php/71495/rubyinstaller-1.9.1-p429.exe), >> It will work. > > > But my environment is Ruby 1.8.7. I need to implement this particular > task in existing application. > Try this code: require 'Win32API' @@kbhit = Win32API.new("msvcrt", "_kbhit", [], 'I') for i in 0..19 unless @@kbhit.call.zero? a = gets() break end sleep 1 end if i==19 puts "Timeout. 20 Seconds Gone. Please re-run the Applciation" end Regards, Park Heesob