Since the latest update of wxCocoaDialog, it has been possible to use it for making custom html dialogs. This gives you a lot more freedom when creating bundle commands as you can now use far richer and more responsive dialogs in your interaction with the user.
As an example of what is possible, and how easy it is to create interactive dialogs, I have created a bundle command version of the excellent Visibone Color Lab.
The modifications to the original html code is really minor. Mainly just moving some frames around and making it update on mouseOver. The interesting part comes where i modify it to return the color code when a color is clicked:
<area HREF=”cocoadialog://%23FFFFFF” onMouseOver=”pick(’FFFFFF’,'W’,'White’)” SHAPE=”POLYGON” COORDS=”184,200,202,168,221,200″>
By giving it a link with the protocol defined as “cocoadialog”, I instruct it to react on a click by closing the dialog and returning the links content (notice the url encoding for the # mark).
To make this into a bundle command, I just have to open the Bundle Editor and create a new command containing the following two lines:
cd "$TM_SUPPORT_PATH/Visibone"
CocoaDialog html --title "The 216-Color Webmaster's Palette" --html-from-file big.html --width 380 --height 542
By first setting the current working dir to the location of the html files (and images), I ensure that the dialog can find all it’s files.
I then set input to “None” and output to “Replace Selected Text”, so that the color code will be inserted in the text when a user clicks a color.
I hope that this has illustrated how easy it is to make html dialogs. Since you have full access to using javascript in your html, there is really no limit to how freeform and interactive you can make it.
Thanks to the kind permission of Bob Stein, the Visibone creator, I have been able to include the color lab in the latest update of e. You can find it as “Insert websafe color” in the HTML bundle.