[TxMt] basic dialog in ruby

Charilaos Skiadas skiadas at hanover.edu
Fri Mar 2 17:25:40 UTC 2007


#!/usr/bin/env ruby
require ENV["TM_SUPPORT_PATH"] + "/lib/dialog.rb"
str = "hi there"
newstr = Dialog.request_string(:title => "Change me!", :prompt  =>  
"Please change me:", :default => str)
if newstr.nil?
	print "You pressed Cancel!"
else
	print "Here's the new string: #{newstr}"
end

On Mar 2, 2007, at 12:04 PM, Piero D'Ancona wrote:

> Hi all.
> Can someone point me to a basic example of
> a dialog from inside a ruby code? My needs
> are basic: at some point my code computes
> a certain string; I want to check the string,
> edit it by hand if necessary, and then continue.
> So I just need something like the example in
> Allan's screencast about tmDialog, only from
> inside some ruby code in a TextMate command.
>
> Thanks,
> Piero

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list