Hi, this might be a very stupid question and I'm not so sure about whether this is the right place to ask either so I hope you can forgive me if this post is in some way inappropriate.
I'm trying to reproduce the screencast about tm_dialog on my computer but somehow it doesn't work. Whenever I try to open a nib-file with "tm_dialog some_nib_file.nib" my shell is stalling but nothing else happens. I wonder what I'm doing wrong!? Are there any Variables I should set?
I'm using /Applications/TextMate.app/Contents/PlugIns/Dialog.tmplugin/ Contents/Resources/tm_dialog (=$DIALOG) on a core duo macbook with 10.4.8. The nib file is saved as 10.2 and later.
Thx, Dominik.
Dominik Gabi wrote:
Hi, this might be a very stupid question and I'm not so sure about whether this is the right place to ask either so I hope you can forgive me if this post is in some way inappropriate.
I'm trying to reproduce the screencast about tm_dialog on my computer but somehow it doesn't work. Whenever I try to open a nib-file with "tm_dialog some_nib_file.nib" my shell is stalling but nothing else happens. I wonder what I'm doing wrong!? Are there any Variables I should set?
If I recall correctly, fix this by passing -p '' (or by doing ctrl+d when stalling, if in the terminal) - it's waiting for STDIN.
I'm using /Applications/TextMate.app/Contents/PlugIns/Dialog.tmplugin/Contents/Resources/tm_dialog (=$DIALOG) on a core duo macbook with 10.4.8. The nib file is saved as 10.2 and later.
Thx, Dominik.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 12. Mar 2007, at 14:12, Dominik Gabi wrote:
[...] I'm trying to reproduce the screencast about tm_dialog on my computer but somehow it doesn't work. Whenever I try to open a nib- file with "tm_dialog some_nib_file.nib" my shell is stalling but nothing else happens [...]
If you do not use -p (to hand it parameters) it will read them from stdin.
So press ⌃D to signal “end of input” and I think it will continue. Alternatively give it -p '{}' as argument.
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
"2007-03-16 00:08:31.124 tm_dialog[4685] *** Uncaught exception: <NSInvalidArgumentException> [NOTE: this exception originated in the server.] *** -[NSCFString setObject:forKey:]: selector not recognized [self = 0x16718a0] Trace/BPT trap"
I also tried "tm_dialog -d..." but nothing seems to work.
2. Has anyone ever tried getting values from a NSTableView? How would I do that?
Dominik.
On Mar 12, 2007, at 3:46 PM, Allan Odgaard wrote:
On 12. Mar 2007, at 14:12, Dominik Gabi wrote:
[...] I'm trying to reproduce the screencast about tm_dialog on my computer but somehow it doesn't work. Whenever I try to open a nib- file with "tm_dialog some_nib_file.nib" my shell is stalling but nothing else happens [...]
If you do not use -p (to hand it parameters) it will read them from stdin.
So press ⌃D to signal “end of input” and I think it will continue. Alternatively give it -p '{}' as argument.
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:
- 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.
Unfortunately I've never written something in ruby therefore I don't understand much of the code you've written. What I tried exactly is:
macbook:~/Desktop dominik$ PLIST=`cat args.plist` macbook:~/Desktop dominik$ echo $PLIST <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-// Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/ PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>debug</key> <integer>1</integer> <key>finalize</key> <integer>1</integer> <key>rootClass</key> <string>my root class</string> </dict> </plist>
Now what I tried macbook:~/Desktop dominik$ tm_dialog -p {$PLIST} MyNib.nib // This returns tm_dialog, usage page macbook:~/Desktop dominik$ tm_dialog -p $PLIST MyNib.nib // The same macbook:~/Desktop dominik$ tm_dialog -p args.plist MyNib.nib // I get the following error:
2007-03-16 01:09:10.776 tm_dialog[4827] *** Uncaught exception: <NSInvalidArgumentException> [NOTE: this exception originated in the server.] *** -[NSCFString setObject:forKey:]: selector not recognized [self = 0x16a5c80] Trace/BPT trap
macbook:~/Desktop dominik$ tm_dialog -p {args.plist} MyNib.nib // The window opens, no error, but the checkboxes aren't checked and my textfield is empty.
Is it wrong to assume, that if I get the values from the nib correctly, it should work the other way around as well!? Maybe I missed a setting in IB?
Dominik
On Mar 16, 2007, at 12:47 AM, Henrik Nyh wrote:
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:
- 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.
On 16. Mar 2007, at 01:16, Dominik Gabi wrote:
[...] Now what I tried macbook:~/Desktop dominik$ tm_dialog -p {$PLIST} MyNib.nib // This returns tm_dialog, usage page macbook:~/Desktop dominik$ tm_dialog -p $PLIST MyNib.nib // The same macbook:~/Desktop dominik$ tm_dialog -p args.plist MyNib.nib // I get the following error:
Do this instead (definitely the best way to pass the arguments):
tm_dialog < args.plist MyNib.nib
Or alternatively:
tm_dialog -p "$PLIST" MyNib.nib
The quotes are important, otherwise the shell will do argument- splitting after expanding the PLIST variable.
[...] Is it wrong to assume, that if I get the values from the nib correctly, it should work the other way around as well!? Maybe I missed a setting in IB?
If I understand you, that is a correct assumption. I.e. the plist returned can be passed in, as it is the data model, so to speak.