Take Command v11 RC1 (build 28) Uploaded

May 20, 2008
469
2
I renew my b27 comment about modifying the @tcl documentation to be about supporting 'Tcl expressions' and not 'Tcl/tk expressions.'

My simple Tcl/Tk script (posted before) executes as expected from the prompt. Here's a new one.

File: test.tcl
Code:
puts "abc"

C:\Tcl\demos\Tk8.5>test.tcl
abc

Unfortunately, this simple command line Tcl script now blocks until the Tk window is closed by the user. I understand you have no way of knowing what kind of script will be executed, Tcl vs Tcl/Tk, without actually parsing the script file(s) first. And, with included files possible, finding a Tk command or 'package require Tk' may be tedious. But, unless both Tcl scripts can be run as under tclsh and Tcl/Tk scripts run as under wish, the behavior may be viewed as 'wrong' by a user.

Tim
 
May 20, 2008
130
1
CA
I get the error System Error: The program can't start because tk85.dll is missing from your system in TCMD x64 11.0.28 on Win7 Ultimate
 

dim

Dimitry Andric
May 31, 2008
205
1
Netherlands
On 2009-10-21 05:58, rconn wrote:

> I've uploaded v11.0.28 (RC1) to the ftp and web autoupdater sites. This should address all known bugs, and it now includes support for Tk scripts.

Unfortunately tcc.exe and tcmd.exe (the x64 versions) now die on startup
with "This application has failed to start because tk85.dll was not
found. Re-installing the application may fix this problem."

Note that I don't have any trace of TCL or TK on my system, TCmd.ini
contains "Tcl=No", and there is no tcl85.dll or tk85.dll anywhere in my
PATH.

This problem does not occur with the x86 version, however.
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
> My simple Tcl/Tk script (posted before) executes as expected from the
> prompt. Here's a new one.
>
> File: test.tcl
>
> Code:
> ---------
> puts "abc"
> ---------
> C:\Tcl\demos\Tk8.5>test.tcl
> abc
>
> Unfortunately, this simple command line Tcl script now blocks until the
> Tk window is closed by the user. I understand you have no way of
> knowing what kind of script will be executed, Tcl vs Tcl/Tk, without
> actually parsing the script file(s) first. And, with included files
> possible, finding a Tk command or 'package require Tk' may be tedious.
> But, unless both Tcl scripts can be run as under tclsh and Tcl/Tk
> scripts run as under wish, the behavior may be viewed as 'wrong' by a
> user.

If you don't want the script to block, then there's no reason to execute it
from TCC -- just use tclsh.

The internal Tcl/Tk support is intended 99% for Tk scripts, as you will see
in future builds.

Rex Conn
JP Software
 
May 20, 2008
469
2
If you don't want the script to block, then there's no reason to execute it from TCC -- just use tclsh.
That's fine. I just wanted to provide you with my feedback so you will know what to include in the documentation to manage user expectations, command line for Tcl/Tk and @tcl for Tcl.

The internal Tcl/Tk support is intended 99% for Tk scripts, as you will see
in future builds.
This reminds me of a feature request I made long ago. Hmmm. :)

Tim
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
> Unfortunately, this simple command line Tcl script now blocks until the
> Tk window is closed by the user. I understand you have no way of
> knowing what kind of script will be executed, Tcl vs Tcl/Tk, without
> actually parsing the script file(s) first. And, with included files
> possible, finding a Tk command or 'package require Tk' may be tedious.

Replace "tedious" with "impossible", given the number of ways that Tk can be
indirectly invoked. And the Tcl/Tk developers apparently don't have any way
of doing it, or they wouldn't need to create multiple variations of the
shell (which require the user to already know how whether it's a Tk script).

The best I can do is *not* do a Tk_Init before the script is invoked, which
requires the user to have a "package require tk" somewhere, and after the
Tcl_EvalFile look for Tk windows. This is necessary because unless I shut
down & reinitialize the interpreter, the next Tk script will fail -- it also
means you cannot have a persistent interpreter executing Tk scripts from the
command line.

I've also added a @TK var function which will allow you to execute a script
without the "package require tk", and which will always create the Tk window
& enter an event loop.

Rex Conn
JP Software
 
May 20, 2008
469
2
The best I can do is *not* do a Tk_Init before the script is invoked, which requires the user to have a "package require tk" somewhere, and after the Tcl_EvalFile look for Tk windows. This is necessary because unless I shut down & reinitialize the interpreter, the next Tk script will fail -- it also means you cannot have a persistent interpreter executing Tk scripts from the command line.
Would it work to have an option for the user to choose which shell to use, tclsh or wish? Requiring the 'package require Tk' with wish would be acceptable for that option (at least for me).

I've also added a @TK var function which will allow you to execute a script without the "package require tk", and which will always create the Tk window & enter an event loop.
Perhaps there could be an optional parameter for both @tcl and @tk, to return the exit code instead of expression result.

Also, @tcl doesn't appear to return the results of an expression. Here's an example:
Code:
C:\Tcl\demos\Tk8.5>echo %@tcl[expr 123 + 456]
expr 123 + 456

C:\Tcl\demos\Tk8.5>tclsh
% expr 123 + 456
579
% exit

Tim

Edit: For some reason, this message was not emailed to me.
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
Would it work to have an option for the user to choose which shell to use, tclsh or wish? Requiring the 'package require Tk' with wish would be acceptable for that option (at least for me).

Perhaps there could be an optional parameter for both @tcl and @tk, to return the exit code instead of expression result.

Also, @tcl doesn't appear to return the results of an expression. Here's an example:
Code:
C:\Tcl\demos\Tk8.5>echo %@tcl[expr 123 + 456]
expr 123 + 456
 
C:\Tcl\demos\Tk8.5>tclsh
% expr 123 + 456
579
% exit

Not sure what you're referring to here -- TCC doesn't use any shell (tclsh or wish) to execute the Tcl/Tk scripts; it runs them internally.

I don't know of a way to have an option to return the result code without interfering with (unknowable) the argument syntax.

The @TCL result string is fixed in build 29.
 
May 20, 2008
469
2
Not sure what you're referring to here -- TCC doesn't use any shell (tclsh or wish) to execute the Tcl/Tk scripts; it runs them internally.

I don't know of a way to have an option to return the result code without interfering with (unknowable) the argument syntax.

The @TCL result string is fixed in build 29.
Without integrated supported, the user would have to explicitly call either tclsh or wish to execute their script. My suggestion is to include a similar choice to set a default for the internal support. The user could choose whether the internal support should include the Tk window and event handler (for Tcl/Tk scripts) or not (for Tcl scripts). Further, something like a setdos command/parameter variant could be used to programmatically switch between the Tcl vs Tcl/tk internal support variations.

Tim
 

rconn

Administrator
Staff member
May 14, 2008
12,312
147
> Without integrated supported, the user would have to explicitly call
> either tclsh or wish to execute their script. My suggestion is to
> include a similar choice to set a default for the internal support.
> The user could choose whether the internal support should include the
> Tk window and event handler (for Tcl/Tk scripts) or not (for Tcl
> scripts). Further, something like a setdos command/parameter variant
> could be used to programmatically switch between the Tcl vs Tcl/tk
> internal support variations.

I don't think there's any need for that. In 11.0.29, TCC will execute the
script (via Tcl_EvalFile), and then look to see if a Tk window was created
(which will happen automatically if the script does something like "package
require tk"). If so, TCC enters an event loop; if not, it's assumed to be a
Tcl script and TCC will return immediately. If you want to make a script
that's uninterpretable even by the Tcl/tk parser, you can force either Tcl
or Tk interpretation by using @TCL and @TK.

The only potential problem I can see with this approach is if you want to
create a Tk script *without* an event loop -- but I don't think there's any
way to do that with tclsh or wish either.

Rex Conn
JP Software
 
Similar threads
Thread starter Title Forum Replies Date
rconn Take Command v11.0.31 uploaded Support 9
rconn Take Command v11 RC2 (build 29) Uploaded Support 1
rconn Take Command v11 Public Beta Build 27 Uploaded Support 10
rconn Take Command v11 Public Beta Build 26 Uploaded Support 8
rconn Take Command v11 Public Beta Build 25 Uploaded Support 6
rconn Take Command v11 Public Beta Build 24 Uploaded Support 10
rconn Take Command v11 Public Beta Build 23 Uploaded Support 2
rconn Take Command v11 Public Beta Build 22 Uploaded Support 23
rconn Take Command v11 Public Beta Available Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
T Take Command 28: Lua reports version 5.4.0 (5.4.3 expected) Support 0
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
J Take command does not start on Windows 10 Support 3
vefatica `Back quotes` - command line vs. batch file Support 5
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 7
Phileosophos Command-line Editing Shortkeys That Fail Support 6
fpefpe How to? free (internal) command Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
T How to? retain command history across reboot? Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
GermanDirk How to? EVENTLOG Command with simple User Rights not functional Support 4
Jay Sage Take Command Is Too Fast! Support 4
Jay Sage Comparison of IF with Command Group and IFF Support 6
D Open Windows 10 Photos app from command line Support 11
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
U Can not get/start Take Command gui Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
S Increasing Font Point Size in Command Tabs Support 2
mfarah Fixed The DATE command produces the wrong error message. Support 1
vefatica Command name mix-up Support 3
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
E How to? Closing desktop created by DESKTOP command Support 10
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
K Take Command fox XP? Support 7
Joe Caverly Documentation Replace internal command with LIBRARY command Support 0
fpefpe How to? command echo in title line/bar Support 2
U Command help on file names Support 5
vefatica Command line DO with no closing parenthesis? Support 9
vefatica Command history search is off Support 7
H How to? How can I say "if the command separator is not ~ then setdos /C~" Support 8
N Command execution slows down in TCC Prompt after a while Support 6
R Long commands retrieved from command history have blank line when wrapped Support 20
jpeni Take Command Language Examples Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
fpefpe winfr command Support 4
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2

Similar threads