From: 12 34 Date: 2007-06-21T03:32:05+09:00 Subject: Re: Default text entered in a puts dialog Jano Svitok wrote: > On 6/20/07, 12 34 wrote: >> For ASers this is equivalent to >> >> set photoGMT to -4 >> display dialog "What time zone are the photos in?" default answer >> photoGMT > > This is the best I can imagine: you cannot fill the input buffer > easily, so I propose to use the default value if the reply is empty. > > photoGMT = -4 > puts "What time zone are the photos in? [#{photoGMT}]" > ans = gets.strip > answer = ans.empty? ? photoGMT : ans.to_i > > > Jano TextMate errors on strip. I change to chomp and TextMate errors on empty field. Works OK if the field is filled in. Thanks for trying. -- Posted via http://www.ruby-forum.com/.