From: Luis Parravicini Date: 2010-10-26T04:40:07+09:00 Subject: Re: Pausable script On Mon, Oct 25, 2010 at 3:26 PM, Ted Flethuseo wrote: > Hi everyone, > > I'm trying to build a script that writes something every 2 minutes. This > is what I have so far, but I would like to make it so that I can pause > it, with a certain key, and make it continue with another key. When it > is unpaused it should keep track where it left off. > > Any ideas how to do this? > > 40.times do |i| >    puts  i >    sleep(200); >    puts "write something" > end You could replace the sleep(200) with a loop doing something like: sleeping a small amount of time (e.g.: 100ms), checking if there's user input available, act accordingly and sleeping again. -- Luis Parravicini http://ktulu.com.ar/blog/