• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Simple Tcl/Tk scripts:

regexorcist

New Member
Joined
Feb 1, 2010
Messages
178 (0.03/day)
Location
~/
System Name Slackware Linux
Processor yes
Motherboard yes
Cooling currently convection, but considering mineral oil
Memory sometimes fails due to too much beer
Video Card(s) ATI Radeon HD5570 series
Storage IDE
Display(s) 32" LCD TV
Case sometimes
Audio Device(s) huh? what? speak up, I can't hear you
Power Supply yes
Software Slackware running Open-Source software (it doesn't get any better)
This thread is for simple tcl ot tcl/tk scripts or code snippets. :)
 
Begining Tcl

Here are a few resources on Tcl I have found to be very useful.

Wikipedia:
http://en.wikipedia.org/wiki/Tcl
Tcl (originally from "Tool Command Language", but conventionally rendered as "Tcl" rather than "TCL"; pronounced as "tickle" or "tee-cee-ell"[2]) is a scripting language created by John Ousterhout[3]. Originally "born out of frustration"[4]—according to the author—with programmers devising their own (poor quality) languages intended to be embedded into applications, Tcl gained acceptance on its own. It is commonly used for rapid prototyping, scripted applications, GUIs and testing. Tcl is used on embedded systems platforms, both in its full form and in several other small-footprinted versions. Tcl is also used for CGI scripting and even in esoteric applications as the scripting language for the Eggdrop bot. Tcl is popularly used today in many automated test harnesses, both for software and hardware, and has a loyal following in the Network Testing and SQA communities.

The combination of Tcl and the Tk GUI toolkit is referred to as Tcl/Tk.


Tcl Man(ual) pages:
http://www.tcl.tk/man/


Tutorials linked from:
http://wiki.tcl.tk/20796

http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
A Tcl 8.5 tutorial written by Clif Flynt, Neil Madden, Arjen Markus, David Welton and others.
It was written with the goal of helping you to learn Tcl. It is aimed at those who have some knowledge of programming, although you certainly don't have to be an expert.
The tutorial is intended as a companion to the Tcl manual pages which provide a reference for all Tcl commands.

http://www.tkdocs.com/
A Tk 8.5 best practices tutorial and documentation web site by Mark Roseman
http://en.wikibooks.org/wiki/Programming:Tcl
A wiki book written by Richard Suchenwirth

http://www.invece.org/tclwise/index.html
A portion of the print book written by Salvatore Sanfilippo is available online. This book is an introduction to the main ideas of the Tcl programming language: If you wish to learn a simple and powerful programming language, this book is for you.

http://www.bin-co.com/tcl/tutorial/contents.php
An online tutorial written by Binny V Abraham.


"Tcl Code Snippets" Search on Google:
http://www.google.com/search?q=tcl+code+snippets&ie=utf-8&oe=utf-8&aq=t


Comparisons:


More to come as I find them!
 
HelloWorld.tcl Example

HelloWorld.tcl
Code:
#!/usr/bin/env tclsh
#
# A simple Hello world in tcl
#
puts "Hello World!"

How to execute in a *nix environment:
**For both instances below the tclsh interpretor MUST be in your current PATH Environment Variable**
**For most* versions of linux this is done for you**
**If you get an error similar to "command 'tclsh' not found" tclsh is not in your current PATH environment variable**


Without adding the executable flag to HelloWorld.tcl:
Code:
$ tclsh HelloWorld.tcl


Add the executable flag to HelloWorld.tcl:
Code:
$ chmod +x HelloWorld.tcl
$ ./HelloWorld.tcl


By reading the tutorials above you may learn the other ways to execute a Tcl script.
I will post Windows instructions when I find them.
 
I am considering working on an IDE for tcl, in tcl. :rockout:
 
Back
Top