Questions tagged [tcl]

Tool Command Language was invented by John Ousterhout as a way to make it easy to write little languages for configuring EDA tools, but it has grown far beyond those humble beginnings to become a general scripting language with built-in asynchronous I/O and Unicode strings while supporting paradigms such as object-oriented programming and coroutines.

Tool Command Language was invented by John Ousterhout as a way to make it easy to write little languages for configuring EDA tools, but it has grown far beyond those humble beginnings to become a general scripting language with built-in asynchronous I/O and Unicode strings while supporting paradigms such as object-oriented programming and coroutines. See the Wikipedia page for Tcl for more information.

The current recommended production release of Tcl is Tcl/Tk 8.6.11 (Dec 30, 2020).

Previous versions of the language are currently relatively common. Tcl 8.5 is widely deployed (current patch version 8.5.18). As is Tcl 8.4 in more conservative deployments (8.4.20 is current, but end-of-lifed there). Use of Tcl 8.4 or earlier is usually not recommended, as it does not receive security-fix support from the Tcl developers.

Naming

You may write the language name as either TCL or Tcl; practitioners tend to prefer the latter on the grounds that it means they don't have to hold the shift key down so long. For pronunciation purposes, either “tee cee ell” or “tickle” are acceptable, depending on audience.

Resources

Books:

Websites:

7056 questions
17
votes
11 answers

Hidden Features of TCL/TK

I've been working with TCL/TK ,recently started to use TCL/TK with my automation applications and I'm hungry for knowledge. To continue with the long line of Hidden Feature questions, I would like to know any hidden or handy features of TCL/TK or…
joe
  • 31,345
  • 29
  • 92
  • 134
16
votes
3 answers

Passing list to Tcl procedure

What is the canonical way to pass a list to a Tcl procedure? I'd really like it if I could get it so that a list is automatically expanded into a variable number of arguments. So that something like: set a {b c} myprocedure option1 option2…
Juan
  • 3,336
  • 3
  • 24
  • 31
15
votes
5 answers

Fullpath of current TCL script

Is there a possibility to get the full path of the currently executing TCL script? In PHP it would be: __FILE__
dmorlock
  • 1,745
  • 4
  • 16
  • 20
15
votes
4 answers

How to get path of current script?

Sometimes its needed to get current path of a script. What are the ways to do that?
vasili111
  • 4,328
  • 6
  • 31
  • 58
15
votes
4 answers

the if statement in TCL

I have a question about if statement in tcl of the following code: if {(($number == 1)&&($name == "hello")) || (($number == 0)&&($name == "yes"))} { #do something here } The above code works, but if I wrote it down like this: if {{$number == 1…
user707549
15
votes
3 answers

TCL obtain the proc name in which I am

How to know what is the name of the proc in which I am. I mean I need this: proc nameOfTheProc {} { #a lot of code here puts "ERROR: You are using 'nameOfTheProc' proc wrongly" } so I want to obtain "nameOfTheProc" but not hard-code. So…
Narek
  • 35,407
  • 69
  • 202
  • 359
14
votes
4 answers

How to run tcl script inside other tcl script?

I have two tcl scripts. I want to run the second script when the first finished. How can I do it?
d_pilot
  • 179
  • 1
  • 2
  • 12
14
votes
2 answers

Background spawned process in Expect

I'm using expect to start an application on my server: #!/usr/bin/expect set timeout -1 spawn "bin/start-all.sh" expect { -re "Found MongoDB in" { send "y\r"; exp_continue } -re "Found Hadoop in" { send "y\r"; exp_continue } -re "Going…
Lucas
  • 419
  • 1
  • 4
  • 11
14
votes
1 answer

How to get the results (standard output) of a TCL exec command?

Say I have a TCL script like this: exec ls -l Now this will print out the content of current directory. I need to take that output as a string and parse it. How I can do this?
Narek
  • 35,407
  • 69
  • 202
  • 359
14
votes
9 answers

Python tcl is not installed properly

I just installed graphics.py for python. But when I tried to run the following code: from graphics import * def main(): win = GraphWin("My Circle", 100, 100) c = Circle(Point(50,50), 10) c.draw(win) …
psiovana
  • 149
  • 1
  • 1
  • 3
13
votes
1 answer

Tkinter's overrideredirect prevents certain events in Mac and Linux

I am writing a program in Python with a Tkinter UI. I want to have a small window with no title bar. This window must receive keyboard input. I am not picky whether this is in the form of an Entry widget or just binding to KeyPress.…
bytesized
  • 1,420
  • 11
  • 22
12
votes
3 answers

How can I avoid an error: No such environment variable?

In my code I am using environment variables, but if it (env.var) doesn't exist, I get the error message NAME_ENV_VAR: no such variable, and my script stops executing. For example, in the line myeval $env($File) I receive an error: can't read…
user782642
  • 221
  • 1
  • 4
  • 5
12
votes
6 answers

Determine type of a variable in Tcl

I'm looking for a way to find the type of a variable in Tcl. For example if I have the variable $a and I want to know whether it is an integer. I have been using the following so far: if {[string is boolean $a]} { #do something } and…
Tom
  • 151
  • 1
  • 2
  • 4
12
votes
11 answers

How do I retrofit a GUI to an existing C program?

I've been working on a project of porting an old solaris CL program to run on Linux, and barring some unrelated hardware issues, that's finished. Now I want a GUI for it, so the user can choose among the various options with drop downs and check…
kajaco
  • 2,507
  • 3
  • 24
  • 33
12
votes
3 answers

Neatly listing values in multiple lines

How does one list values in multiple lines without a backslash at the end of each line? One can't create a list in multiple lines without having a backslash at the end. For example, the following (wrong) code: set pets [list cat dog …
Dor
  • 6,916
  • 4
  • 28
  • 45