From: Raveendran .P on
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.


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

From: Heesob Park on
Hi,

2010/7/14 Raveendran .P <jazzezravi(a)gmail.com>:
> 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

From: Michael Fellinger on
On Wed, Jul 14, 2010 at 5:48 PM, Raveendran .P <jazzezravi(a)gmail.com> wrote:
> 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.

if select([$stdin], nil, nil, 20)
p gets
end

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



--
Michael Fellinger
CTO, The Rubyists, LLC

From: Ammar Ali on
[Note: parts of this message were removed to make it a legal post.]

On Wed, Jul 14, 2010 at 12:07 PM, Michael Fellinger
<m.fellinger(a)gmail.com>wrote:

>
> if select([$stdin], nil, nil, 20)
> p gets
> end
>
>
IIRC, the last time I tried that on Windows (a while back) the select
returned on the first char and then gets acted as usual, blocking until EOL.
I would like to know if that actually works.

Ammar

From: Raveendran .P on

Hi,

Thanks Park. Your code helps me to complete the task.

If any other solution please update here...




The below code also not working in Windows XP and Ruby 1.8.7

>> if select([$stdin], nil, nil, 20)
>> p gets
>> end


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