[TxMt] Fwd: tm_dialog won't open window

Henrik Nyh henrik at nyh.se
Thu Mar 15 23:47:31 UTC 2007


Dominik Gabi wrote:
> Thx for your help. I could play a little bit around with tm_dialog the 
> last few days but there are still some things I don't get:
> 
> 1. How do I pass default values to the elements of the nib file. I tried 
> "tm_dialog -p {arguments.plist} my_nib_file.nib" in several variations 
> but it always results in an error like

Assuming Ruby:

	require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
	require "#{ENV['TM_SUPPORT_PATH']}/lib/osx/plist"

to get methods for e.g. shell escaping and plist stuff, respectively. 
Then you could write code like

	defaults = {"key" => "value", "key2" => "value2"}
	response = `$DIALOG -p #{e_sh defaults.to_plist} #{e_sh 
"#{ENV['TM_BUNDLE_SUPPORT']}/nib/SomeDialog.nib"}`
	response_hash = PropertyList::load(response)
	puts "key2 is now #{response_hash["key2"]}!"

I believe the hash must have string keys, not symbol keys. e_sh() 
escapes for the shell.



More information about the textmate mailing list