Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Launching Tkcon with a main script and another as arguments

30 views
Skip to first unread message

ton...@googlemail.com

unread,
Jun 28, 2007, 2:56:12 PM6/28/07
to
>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

unread,
Jun 28, 2007, 4:51:03 PM6/28/07
to
At 2007-06-28 02:56PM, "ton...@googlemail.com" wrote:
> >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'

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

ton...@googlemail.com

unread,
Jun 29, 2007, 2:45:06 AM6/29/07
to
> 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

unread,
Jun 29, 2007, 1:21:49 PM6/29/07
to ton...@googlemail.com
ton...@googlemail.com wrote:
>>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).

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

ton...@googlemail.com

unread,
Jun 29, 2007, 6:52:47 PM6/29/07
to
> 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

0 new messages