Updated 2011-09-22 04:33:22 by RLE

As one comp.lang.tcl poster summarized,
  source YOUR_FILE

in tclsh/wish/whatever.

There are a lot of other possibilities, in fact. CL argues that Tcl isn't so much a language as a collection of tools, and different craftsmen favor almost disjoint bundles of implements for their specialties.

Here's a bit more detail about the possibilities: those sitting at a MacOS or Win* desktop will first launch an interpreter by double-clicking on the appropriate installed icon. They'll see then (perhaps along with other elements) a text area with a % prompt. The correct action in this case is to type
  source YOUR_FILE

at the %.

Win* users might eventually have occasion to command something like
  "\Program Files\tcl\bin\tclsh83" YOUR_FILE

at a DOS-box command line.

There are also several ways to make YOUR_FILE itself "clickable". If its name is of the form

it should be, already. Even once its launched, there might still be issues about this mode; a conventional installation "hides the console" when used this way. As with most things Tcl, though, it's possible to adjust this behavior.

KBK (9 January 2001) - Specifically, if you always want the console to show when you launch the program, put
    catch { console show }

somewhere in the script. Popping up a console when you have another GUI is a little annoying, though. If your app has a menu bar, putting a console control in the system menu is a better approach.

LV: On Unix, several options are available. One can start up a tclsh or wish and then source in the file, as mentioned above. In addition, one can start wish or tclsh up with the name of the text file - the file immediately executes. Also, one can add, as the first line of the text file, something similar to:

#! /path/to/tcl/or/wish

and then save the file, and from the command line invoke the chmod unix command with an initial argument of 755 or rwxr-xr-x or u+rwx,g+rx,o+rw and then the file can be directly invoked.

WARNING! In this last case, the pathname in the #! is likely to need to be short - while the length varies from implementation to implementation, most unix-like systems implement some sort of maximum value (sometimes as short as 30 characters) for the line.

RS: See exec magic for the coolest way, where you don't have to know where tclsh or wish sit...

LV: On the Mac, there is a mechanism for setting the owner of a text file in such a way that the application is directly invokable. In fact, the Mac Tcl/Tk comes I believe with an app/icon onto which you can drop your tcl text files and their owners will be set appropriately.