launching wish from tclsh
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

launching wish from tclsh

From: Andry <yandry77@gmail.com>
Date: Fri Feb 17 2006 - 21:24:46 CET

Hi,
I'm trying to create some scripts to run Ixia performance tests using a
console interface (tclsh) in place of a gui interface for input of test
parameters. Gui-based Ixia tests are basically Tcl/Tk scripts that can
be run using tcl packages (IxTclHal) only accessible from wish and not
from tclsh.
So, I proceeded creating a tcl script that, running from Tclsh, gets
the parameters (strings) from the user (gets stdin ...) and put the
values in a ".tcl" file that can be run from wish (the values are saved
as strings in the middle of IxTclHal commands).

My problem is the following:

If I open a Tclsh console and I manually try to launch wish console
(from tclsh console) using the simple command "% wish83.exe
scriptname.tcl", it works fine (wish console opens up and I can see the
script running on wish console).
If I try to use the same command as part of a tcl script that I run
from tclsh (the same script that collects user's input from console)
then I get the following error:
% invalid command name "wish83.exe"

I also tried with: % exec "wish83.exe test-choice.tcl", but I get the
folowing error:
% couldn't execute "wish83.exe test-choice.tcl": no such file or
directory

I also tried simply using: % exec "wish83.exe", but, in that case, wish
console opens up but the Output of the screen is redirected to Tclsh
stdout and it's not actually displayed until I manually exit from the
wish console and get back to Tclsh console. Btw, in this case the wish
console doesn't even show the "%" prompt. So, I can manually run the
script, but the output of the console will only be displayed after the
script is done and on the Tclsh instead.
For the purpose of my tests, I need to see the output of the script
real-time (although there is no user input needed once the script from
wish is launched).
I think this problem has to do with the fact that wish has no
stdin/stdout unlike tclsh.
But consider that, as I said before, if I manually launch wish from the
Tclsh console, it works.
How can I achieve the same result from inside the script?

In other words, how can I launch the wish console and start the script
automatically (through wish) using a Tcl script that is run through the
Tclsh console?

Thanks a lot,
Andrea
Received on Sun Apr 30 02:08:40 2006