From: Bernhard S. <Ber...@gm...> - 2013-09-21 12:53:09
|
Hi, For years I was looking for a simple way to restore the behavior that was once provided by Daniel Steffen's "Launcher", namely running a Tcl/Tk script simply by double clicking on it in the Finder. I understand that there are several ways to get a similar and even more Mac like behavior as documented here: http://opensource.codebykevin.com/tutorial.html. While packaging scripts in StarPacks or even a real Mac app bundle provides the best Mac application experience, I was looking for a solution, that does not require repackaging when a new version of wish would come along. Also, I was looking not for a solution for packaging and shipping finished apps but for a more lightweight solution that simplifies running scripts during development and running some simple apps for home use (but, of course, without resorting to the command line). Just recently I discovered by more or less putting together several pieces that were floating around on the web, that I could achieve exactly what I wanted by simply putting the script proc my_open_document {file} { if [catch {uplevel #0 [list source $file]} errorInfo] { puts $errorInfo } } proc ::tk::mac::OpenDocument {args} { foreach f $args { my_open_document $f } } into Wish.app/Contents/Resources/Scripts/AppMain.tcl and associating Wish.app with files ending in .tcl. Now, double clicking on any tcl file in the Finder launches Wish.app and tells Wish.app to run the script. For me, this is the most natural behavior what Wish.app should do on the Mac. (Wish acts in this way on Windows, too.) So my question is: why hasn't this been implemented this way? Why is this not the default Wish behavior on the Mac? Are there any drawbacks/problems with this approach? Thanks, Bernhard |