Tag Archives: cross-platform

tcl – choirs of singing angels

seriously, I have not had this much of a eureka moment since I ran my first rails application.

TCL is an ancient, Lisp-inspired, unix based scripting language – what’s so exciting about that?! Let me tell you…

TCLKIT is a redistributable binary version of TCL/TK, prepackaged for Windows, Mac, Linux and Solaris on multiple architectures (and, if you can find a platform they haven’t built it for yet, you can always download the code and build it yourself :)). A quick test of mine has shown a (very basic) GUI prompt is possible on Windows 7 64-bit, Windows XP 32-bit, Mac OS X (10.6), openSUSE 64-bit (gnome) and ubuntu 32-bit (kde), all using ONLY the appropriate TCLKIT binary and the following three lines of code:

package require Tk
label .hello -text "Hello World"
pack .hello

More importantly, it also has a kickass interface for catching stdout from preinstalled command line utilities, namely:

set output [exec ls -la /]

will do exactly what it looks like – run the shell command and store the stdout in a variable called output. (which you have to call $output for the rest of the script.)

That is all for now, more posts if I find anything else awesome (or terrible) about this way of writing short cross platform scripts to wrap command line calls in string parsing complex logic, and occasionally firing simple dialogs.