[TxMt] async tm_dialog

Brett Terpstra brett at circlesixdesign.com
Wed Jun 27 21:31:35 UTC 2007


I think I've got the gist of this, but the osascript part errors out  
because the dialog is the frontmost window when clicked and it can't  
insert text there.  Any workaround for that?

Brett

On Jun 25, 2007, at 6:55 AM, Allan Odgaard wrote:

[snip]
>
> If your command holds the ruby script itself then do something like:
>
>     #!/usr/bin/env ruby -wKU
>
>     # since TM won’t wait for us, send output to console
>     STDOUT.reopen('/dev/console', 'w')
>     STDERR.reopen('/dev/console', 'w')
>
>     pid = Process.fork do
>       # actual code starts here
>       sleep 2
>       %x{osascript -e 'tell app "TextMate" to insert "${0:Hello,  
> world}" as snippet yes'}
>     end
>
>     Process.detach(pid)
>
>> 2.  I'd like to be able to keep the "palette" open and insert  
>> snippets (or tags in this case) as I go, rather than upon window  
>> close.  I'd like to use this for both the Autotag bundle and the  
>> Wordpress bundle, keeping a palette of Tags/Wordpress snippets  
>> open and insertable at any time.  Any way to do this?
>
> Yes, using -a and -w to wait for an action, then use osascript as  
> in the above command to actually insert the stuff and go back to -w.
>
> You can bind the doubleClickTarget/Argument of the table view as  
> shown in the latest dialog to make tm_dialog “return” when an item  
> in your table view is double clicked (remember to disable editable  
> for the table column, so that double click does not start editing),  
> then just go back to -w(ait) again (instead of closing the palette  
> with -x).
>
> I believe you can set the attributes of the window to be utility /  
> always on top / non-activating or something like that to make it  
> act like a palette.
>



More information about the textmate mailing list