[TxMt] Re: how to call CocoaDialog from Ruby?

Matt Neuburg matt at tidbits.com
Thu Apr 17 17:20:28 UTC 2008

On 4/16/08 1:29 PM, in article nemoWed041608032838 at news.netfielders.de,
"Christoph Koehler"
<christoph.koehler at gmail.com> wrote:

> In article <C42BA0B9.3B603%matt at tidbits.com> Matt
> Neuburg<matt at tidbits.com> wrote:
>>  In my Ruby script which is called somewhat indirectly, I tried
>> saying `CocoaDialog blahblah` but it didn't work; evidently the
>> indirectness means that I'm not inheriting some path trickery from
>> TM. So I changed it to this:
>> `#{ENV['TM_SUPPORT_PATH']}/bin/CocoaDialog.app/Contents/MacOS/CocoaDia
>>  logblahblah`
>>  That works. But is there a better way? Thx - m.
> Here's how I do it:
> #! /usr/bin/env ruby
> require ENV['TM_SUPPORT_PATH'] + '/lib/ui'
> test = TextMate::UI.request_string(:title => "Some title", :prompt =>
> "Please type something here")

Interesting - thanks for that. Unfortunately, this little library doesn't
implement "filesave" (which is what I want to use), and its most general
bottleneck method, cocoa_dialog, is private. So I guess I'll just stick with
what I've got... m.

matt neuburg, phd = matt at tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!

More information about the textmate mailing list