tcl

tcl exec reads stdout first then stderr?

Hi, I found tcl exec command returns string from stdout first then stderr. For example, my following "test script" generates messages in this order: puts "test started" puts stderr "some non-fatal error goes to stderr" puts "test passed" Then I execute the script like this: set ret [ catch { exec sh -c $cmd } msg ] and what I get...

How to create a status line with ttk?

How do you create your status line at the bottom of your window? An inactive entry does not look very nice. What other options are there? Is possible to integrate a progress bar which is visible only on demand? (I am using tk and ttk from within R.) EDIT: Now here is my second version, which works fine for me, but I would like to disp...

Why this expect script gives an error when it's run by cron?

I can run this expect script just fine using root or my own user account, however when I run it with cron, I always get an error. The OS is Ubuntu 8.04. Error email is as follows, Date: Thu, 26 Aug 2010 11:50:01 -0400 From: root@supa (Cron Daemon) To: root@supa Subject: Cron <root@supa> /home/myusername/bin/uploadmyip myserver.com can...

trouble with ramdebugger and tcl/c++ loadable module

I have a nice fully functioning module (wrtten using tcl/cpp) it works fine. I want to use ramdebugger to debug scripts using that module When I enter load mylib.so command1_from_lib xx command2_from lib yy If (say) command2 returns an error then ramdebugger dies [paul@paul-es5 ramdebugger7.7.1]$ ./ramdebugger alloc: invalid bloc...

How to make tclsh to ignore EOF?

At csh you can do set ignoreeof or at bash tou can do export ignoreeof=1 and this will make csh/bash to ignore EOF, i.e. it will not exit on Ctrl+D, or when it reaches the end or file. Is there a way to make the same with tclsh ? Is there a way to make tclsh not to exit when it reaches the end of file ? ...

What is a good way to show different content dynamically (in Tcl/Tk)?

I have a set of radiobuttons (say, with choices 1 and 2) and need to show some widget based off of the user's choice. For example, if they chose 1, I would show them a labelframe with several radiobuttons; whereas, if they chose 2, I would show them a labelframe with some buttons. In either case, the resulting content would be shown in t...

TCL regsub isn't working when the expression has [0]

I tried the following code: set exp {elem[0]} set temp {elem[0]} regsub $temp $exp "1" exp if {$exp} { puts "######### 111111111111111 ################" } else { puts "########### 0000000000000000 ############" } of course, this is the easiest regsub possible (the words match completely), and still it doesnt work, and no sub...

which language (python/perl/tcl) on linux doesn't need to install the third-party libs?

When deploy java app on linux, we don't need to install anything, all third-party libs are jar files and we only update classpath in script file. But java needs jre which is quite large. So is there any other language supported by linux can do that? By default our server only support perl/python/tcl, no gcc available, sigh. ...

Fullscreen mode with Tk

Is it possible to create some kind of fullscreen mode (e.g. no window title bar) in Tk applications? ...

Emulating lisp cons cells in Tcl

A list in lisp is a series of cons cells, but in Tcl, a list is a string with whitespace separating the elements. For translating code from lisp to tcl, one might simply take lisp lists and translate them to Tcl lists. However, this runs into trouble with side effecting cons cells not coming across to the Tcl code. For example, consid...

TCL hangs when trying to close TCL pipe

When launching tclsh and typing this: close [open "|tclsh" w] it works fine. But, when in ~/.tclshrc you have package require Tk, the same line makes tclsh to HANG! The same issue is with all GUI packages like Tk, Itk, Img, Iwidgets, however with not GUI packages like Itcl, it worsk fine. How can I fix this issue? The point is to m...

Why -editable is not working in iwidgets (tcl/tk)?

I was trying to use iwidgets in some GUI and I want to make combobox non-editable. As per activetcl documentation, the -editable option is mentioned for combobox and yet it is not working. combobox $frm_sat1.c2 \ -textvariable [itcl::scope type] \ -state normal -entries {"1 opt" "2 opt"} -editable 0; help me! ...

How to split a variable in two args with exec in TCL ?

Hello, I want to create a simple Console in Tcl/Tk I have two problems. First changing every * with a [glob *] but also, when my entry contains "ls -a" it doesn't understand that ls is the command and -a the first arg. How can I manage to do that ? Thanks proc execute {} { # ajoute le contenu de .add_frame.add_entry set valu...

could not able to spawn(ssh) using expect

Hi.. while executing $expect filename.exp user pwd ip I got the error could not execute "ssh -l user ip": no such file or directory The contents of filename.exp are this: #!/opt/sfw/bin/expect -D set OMC_Usr [lindex $argv 0] set OMC_Pwd [lindex $argv 1] set OMC_IP [lindex $argv 2] set cmd "ssh -l $OMC_Usr $OMC_IP" spawn $c...

Recommended way to load .so package in tcl either statically or dynamically

I've an executable hosting tcl interpretor, and a library hosting a extension. I want to be able to build the library dynamically (loaded with Tcl's load) or statically (single executable, or so loaded implicitly). The Executable code: #ifdef GO_STATIC extern int My_ext_Init(Tcl_Interp* interp); Tcl_StaticPackage(interp, "my_e...

Ruby version of the TCL-based Expect?

Expect seems to be a very powerful automation tool: http://www.nist.gov/mel/msid/expect.cfm Is there a Ruby equivalent to that tool? ...

Other solutions/languages that are superior to the TCL-based Expect?

I am amazed by how Expect (TCL) can automate a lot of things I normally could not do. I thought I could dig deeper into Expect by reading a book, but before I do that I want to ask if there are other solutions/languages that could do what Expect does? Eg. I have read that people compare Expect with Awk and also Perl. Could Awk and Per...

Expect works great interactively but not from file

It works great when I use expect interactively like this: root@vagrantup:/home/vagrant> expect -i expect1.1> spawn screen -x spawn screen -x 3195 expect1.2> send "ls\n" expect1.3> exit But the same commands used in a file: spawn screen -x send "ls\n" exit Only works sometimes, eg. 1/10 time every time I execute the file. It's reall...

Do an action for every match in expect

Hello, I am a total expect noob. I am writing a expect script for a test case where I want to count the number of occurrences of the string "Ok" and do an action for every occurrence from the following output: Reloading configuration on all nodes Reloading configuration on node 1 (node1-c5) OK Reloading configuration on node 2 (node2-c...

Calling Tcl procedures with Function pointers as argument from Python

Hi Is it possible to call Tcl procedures that have function pointers (or callback functions) from Python? I am using Tkinter to call Tcl procedures from Python. Python Snippet : proc callbackFunc(): print "I am in callbackFunc" cb = callbackFunc Tkinter.Tk.call('tclproc::RetrieveInfo', cb) Tcl Snippet : proc tclproc::RetrieveI...