tcl

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 any easy method to achieve some big operations ...

Using Tcl encoding command to convert from Traditional Chinese to Simplified Chinese

I support a website written in Tcl which displays data in Traditional Chinese (big5). We then have a Java servlet, using the translation code from mandarintools.com, to translate a page request into Simplified Chinese. The conversion as specified to the translation code is from UTF-8 to UTF-8S; Java is apparently correctly translating...

SQLite: Copy all values from a previous row with one substitution.

Hi y'all, Using SQLite I need to copy nearly all of an existing row from a table, make a change to a single column, and insert the new row into the table. Something roughly like INSERT INTO $tablename (c1, c2, ... , cn) SELECT (c1, c2, ... , cn) FROM $tablenam I tried substituting a some value ci into the the list of SELECT colu...

How do I get the current month in tcl?

How do I get the current month as an integer, and as a string? So for this month, I would want "7" and the string "July". Is there an easy way to do this without a lot of string parsing and a lookup list for month names? ...

Getting started with Tcl TK?

Hi, One of my modules at university next year is going to involve programming in Tcl tk, I was wondering where to find the best resources and information about the language, so that I am well prepared. I'm currently looking on this site which is pretty helpful, but the book that they recommend is quite old, and I was wondering if someo...

TCL Question? tcl router programming

Hi buddies, I added a new line at the middle of two fsm definition and got error while running it via router.the newly added line is in bold `init_ConfigVars #---------------------------------- # State Machine #---------------------------------- set fsm(any_state,ev_disconnected) "act_Cleanup same_state" set fsm(CALL_INIT,ev_setu...

Problem executing TCL script from Bourne Shell (redirection trouble)

I am working with VMD (a molecular dynamics visualization package) and I want to open VMD from a Perl script, run a Tcl script, print the output to a log file, then close VMD and return to the Perl script. The ordinary syntax to do this is: system("vmd -dispdev text -eofexit < program.tcl > LOG"); which breaks down as follows, as best...

Should I use Perl/Tk, Tcl::Tk or Tkx for a Perl GUI?

I really like Perl/Tk, but have come to the opinion that it's DOA. I think Tcl::Tk and Tkx are better solutions. Assume I drop Perl/Tk. Is the "most supported" route to go with Tcl::Tk (which hasn't been updated since 2007, and whose author seemingly cannot be reached), or Tkx? Are either of these actively used/supported? ...

Why is the creation order of widgets important?

The following code works fine. It displays a panedwindow, with a blue box on top and a green box below: panedwindow .root -orient vertical -showhandle true -background red frame .top -background blue -width 100 -height 100 frame .bot -background green -width 100 -height 100 .root add .top .bot pack .root -expand true -fill both Howeve...

Why are all the tk examples in a Python distribution written in TCL?

Now don't get me wrong, I'm not exactly a Python fan, but when you see a Tk directory inside of the python directory you kinda expect... Well Python. And yeah, I get that Tk came from TCL, but if I had to write a TCL to use Tk, I'd forget TK existed and use a completely different tool box. (The popularity of this combination completely ...

Exit status code for Expect script called from Bash

I made a Bash script which uses an expect script to automate ssh logins.The script connects to multiple servers and runs some commands. The bash script prompts for login credentials once. I want to incorporate a feature wherein the script terminates if the login fails for the first server to avoid the script checking for next servers re...

How to execute tcl script from php ?

Hello All, I need to execute a TCL script from PHP. At the moment I am using the following code <?php echo passthru("tclsh83 Testcases/source.tcl "); ?> This is working. But this creates a shell for each call . How do I open a shell and communicate to and fro from the TCL script . Any pointers will be appreciated . Regards, Mithun...

Server code execution

Hello All, I have some TCL scripts on the server . I am using a client (html/php ) to call them . I want to know if each seperate http request ( to call a TCL script from php script ) executes in separate thread ? i.e can i have multiple instances calling the same TCL script ? Could some one throw some light on this . Regards, Mithun ...

Slow response to database write from php

Hello All, I have my PHP scripts running on the WAMP server. Here's what i am doing PHP script A that queries the database and gets a set of rows (I have set the set_time_limit (0) // unlimited time for the script to execute ) Based on the result set I execute a tcl script for each row of the result set The TCL script takes about a...

How can I dynamically populate the values of TK combobox ?

I am new to tcl/tk programming. Here is a small code snippet on combo box. How can I dynamically add and remove values from the combo box? set ff [ frame f] set label [Label $ff.label -text "Name:" ] set name [ComboBox $ff.name \ -editable yes \ -textvariable name] set addButton [Button $ff.addButton -text "+" -width 1...

Using proc_open function in PHP

Hello All, I am trying to execute a TCL script from PHP. I am using PHP's proc_open for the communication .But I am unable to get the result from the tcl script . Can someone go through the code and let me know where I am going wrong ? PHP code <?php $app = 'tclsh84.exe'; $spec = array(array("pipe", "r"), array("pipe", "w"), array(...

How do I create and iterate through a hash of hashes in TCL?

How do I create and iterate through a hash of hashes in TCL? If I have data like: foo = { a => { aa => { aa1 aa2 aa3 } ab => { ab1 ab2 ab3 } ac => { ac1 ac2 ac3 } } b => { ba => { ba1 ba2 ba3 } bb => { bb1 bb2 bb3 } bc => { bc1 bc2 bc3 } } c => { ca => { ca1 ca...

How to make fread blocking and read until the end ?

Hello, I am executing a TCL script from PHP using proc_open. I first open the TCL shell 2) Send a command using fwrite 3) What I need is fread to wait/block until the command sent by fwrite is complete and get all the contents .The command may take some time to complete. (I am able to read just 2 lines and then it is going off to th...

Passing a file descriptor opened in C to a tcl interpreter for use

I have a C program in which I create a tcl interpreter. I then open a file in the C program and want to pass it onto the tcl interpreter so the tcl interpreter can do I/O on it. And I realize I could just open the file in the tcl interpreter, but I get an open file descriptor some somewhere else, so that's not an option, unfortunately. ...

Can't create file using TCL,which is executed through PHP

Hello, I have a PHP script that executes a TCL script . The TCL script creates a file , but when I execute through PHP (from browser) , tcl is not able to create a file. Can anyone guide me . //PHP code <?php $app = 'tclsh84'; $descriptorspec = array( 0 => array("pipe","r"), 1 => array("file","C:/wamp/www/tcl/bin/out.txt","w"), 2 ...