On Oct 22, 2006, at 8:18 AM, Andy Herbert wrote:

I've been trying to come up with a solution to creating shell scripts within Textmate and creating a widget on the Dashboard layer to call the script with references to any files or URLs passed to it, and I have eventually come up with a Textmate widget & bundle to do all this.

I've created a screencast (sorry - no audio) to show the various features of the bundle and the widget, and it can be found at:

http://homepage.mac.com/andy.herbert/Textmate-widget.mov

Features shown in the screencast include:

The actual widget is included inside the bundle and is installed in ~/Library/Widgets/ the first time you call the bundle command to create a new widget using the currently opened document.

To call a script using the widget click on the Textmate icon, to pass files to the script as $1, $2.. etc drag files from Finder on to the Textmate icon, you can also drag a URL on to it if you have a web-browser open, this too is passed as $1.

If when the script is called there is any output a green icon will appear on the widget, and when this is clicked you will be able to view the output log, same goes with any errors the script throws up, except this time the icon is red.

Flipping the widget over will allow you to edit the widget's label or modify the script the widget uses. All scripts used by the widget are held in ~/Library/Application Support/Textmate/Widget Scripts/ and are deleted when you remove the widget.

Both the output and error logs are stored in ~/Library/Logs/, each widget has a separate file, and is deleted and re-created each time each script is called.

The widget bundle can be found at:

http://homepage.mac.com/andy.herbert/Widget.tmbundle.zip

I hope it might be useful to someone else on this list.

This looks like it's going to be totally stinking awesome.
One problem from the getgo however.
I want to use existing scripts that already have names and stuff without being deleted when closing the widget.
Can you make it link to existing scripts easily?

Link open document into new widget
and then change the existing one to:
Copy open document into new widget

Something like that.
Yes, i know i could just call the existing script from the temporary widget script, but that's a whole extra unnecessary layer.

This is going to be totally awesome!

thomas Aylott — subtleGradient — CrazyEgg