Home > Archive > Tcl > June 2007 > Launching Tkcon with a main script and another as arguments
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Launching Tkcon with a main script and another as arguments
|
|
| tonydoy@googlemail.com 2007-06-28, 7:12 pm |
| >From within the wish console I am launching the Tkcon console with my
mainScript.tcl and configScript.tcl, which is required by
mainScript.tcl as an argument. The command I am using in the wish
console is
'exec wish tkcon.tcl -- mainScript.tcl configScript.tcl'
The Tkcon console is launched and mainScript.tcl is sourced but then
fails because it doesn't have a configuration script as an argument.
It seems that configScript.tcl is NOT being considered as an argument
and is considered to be sourced a separate script (which fails because
it just contains user defined constants).
Is anybody familiar with how to launch Tkcon with configScript.tcl as
an argument to mainScript.tcl?
When I launch the wish console from the windows command prompt as
follows then all is well.
'wish.exe mainScript.tcl configScript.tcl'
I have spent nearly two days on this now but am still getting
nowhere. Any pointers would be greatly appreciated.
Regards
Tony
| |
| Glenn Jackman 2007-06-28, 7:12 pm |
| At 2007-06-28 02:56PM, "tonydoy@googlemail.com" wrote:
> mainScript.tcl and configScript.tcl, which is required by
> mainScript.tcl as an argument. The command I am using in the wish
> console is
>
> 'exec wish tkcon.tcl -- mainScript.tcl configScript.tcl'
A guess: what happens if you:
exec wish tkcon.tcl mainScript.tcl -- configScript.tcl
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
| |
| tonydoy@googlemail.com 2007-06-29, 8:08 am |
| > A guess: what happens if you:
> exec wish tkcon.tcl mainScript.tcl -- configScript.tcl
Just tried what you suggested but still to no avail.
The tkcon window shows that it is still trying to source the
configScript.
I can confirm that the llength of argv is 0.
I'm sure the answer is staring me in the face but I just can't see it.
| |
| Jeff Hobbs 2007-06-29, 10:08 pm |
| tonydoy@googlemail.com wrote:
> mainScript.tcl and configScript.tcl, which is required by
> mainScript.tcl as an argument. The command I am using in the wish
> console is
>
> 'exec wish tkcon.tcl -- mainScript.tcl configScript.tcl'
>
> The Tkcon console is launched and mainScript.tcl is sourced but then
> fails because it doesn't have a configuration script as an argument.
> It seems that configScript.tcl is NOT being considered as an argument
> and is considered to be sourced a separate script (which fails because
> it just contains user defined constants).
First, try updating to the latest in CVS (you can do this via tkcon's
Help -> Retrieve Latest Version if it is relatively recent).
Then do:
wish tkcon.tcl mainScript.tcl -- configScript.tcl
I think there was a bug in the -- handling previously that I've
corrected. Let me know whether it works or not.
Jeff
| |
| tonydoy@googlemail.com 2007-06-30, 4:18 am |
| > First, try updating to the latest in CVS (you can do this via tkcon's
> Help -> Retrieve Latest Version if it is relatively recent).
>
> Then do:
>
> wish tkcon.tcl mainScript.tcl -- configScript.tcl
>
> I think there was a bug in the -- handling previously that I've
> corrected. Let me know whether it works or not.
>
> Jeff
Hi Jeff,
>From the help of my current tkcon I can see that I have v2.4, CVS
v1.98. I tried 'Retrieve Latest Version' but got the error message
"Failed to retrieve latest tkcon source: expected http return code
200, received 403".
I therefore performed
tkcon master set ::tkcon:PRIV(proxy) wwwproxy:8080
and tried again, but still the same error message.
I decided to go direct to http://tkcon.sourceforge.net/ and downloaded
tkcon from there. I now have v2.5, CVS v1.101.
I ran the script again (with fingers crossed) but still,
mainScript.tcl is complaining that is does have any arguments :-(. I
have written the following very simple script to test this;
mainScript.tcl:
if {[llength $argv] == 0} {
puts "ERROR, no argument provided"
update
after 5000
exit
} else {
puts "SUCCESS: Argument \"[lindex $argv 0]\" provided"
update
source [lindex $argv 0]
puts "Constant1 = $CONSTANT1" ;# CONSTANT1 is only defined in the
sourced file
update
after 5000
exit
}
I then launched this from the wish console as follows
exec wish "D:/Tcl/bin/tkcon.tcl" "mainScript.tcl" --
"configScript.tcl"
But it runs as expected if I type the following in to Windows command
prompt
wish "D:/Tcl/bin/tkcon.tcl" "mainScript.tcl" "configScript.tcl"
Incidentally, I have noticed that I have to change directory to where
my scripts are and then run the exec command because tkcon complains
that no such file or directory exists if I type the following
(specifing the full path).
exec wish "D:/Tcl/bin/tkcon.tcl" "H:/Tone/My Documents/TCL/
tkcon_scripts/mainScript.tcl" -- "H:/Tone/My Documents/TCL/
tkcon_scripts/configScript.tcl"
Am I doing something wrong?
As always, guidance and pointers are most welcome.
Regards
Tony
|
|
|
|
|