Version 46 of Coming to Tcl/Tk from an IDE environment

Updated 2010-04-29 04:30:48 by aricb

Ari: I was so frustrated that there is no basic IDE for TCL that I wrote two very basic BATCH files that will get the trick done.

You can accomplish the same thing by running a fraction of this code every time in the run command but I figured this might get the job done especially if you are a beginner and just playing around with "Hello World" TCL application. Though this program isn't much it can be really helpful to those newbies like myself.

Hard-coded file

Rem This program will run any TCL file in the "Programs" folder through a DOS IDE of the ActiveTCL machine
Rem Note: Filename must be hard coded into this BATCH file

Rem Create command line that will read this file:
Rem "C:\...\Programs\<file name>"
Rem Run it in here:
Rem "C:\Tcl\bin\tclsh85.exe"
Rem And then wait under you press enter to exit

@echo off

cls

ECHO Program begins here...
ECHO "<------------------>"
ECHO.
ECHO.

Rem Set the file name of target TCL file to run
Set filename=hello.tcl

Rem Target TCL Engine
Rem Example: Using ActiveTCL
Set engine=c:\Tcl\bin\tclsh85.exe

Rem Start folder where TCL file is located
Set folderpath=C:\...\Programs\

Rem Run the TCL program via the engine
%engine% %folderpath%%filename%

ECHO.
ECHO.
ECHO "<------------------>"
ECHO Program ends here...

Rem Waiting for user to press a key to quit
Pause

Passing parameter in RUN or command prompt

Rem This program will run any TCL file in the "Programs" folder through a DOS IDE of the ActiveTCL machine
Rem Note: Must include filename in the the argument therefore it must be run in a command prompt (or Run)
Rem Example: Run the code by going into command prompt and typing "TCLRun.bat hello.TCL"

Rem Create command line that will read this file
Rem "C:\...\Programs\<file name>"
Rem Run it in here:
Rem "C:\Tcl\bin\tclsh85.exe"
Rem And then wait under you press enter to exit

@echo off

cls

ECHO Running: %1
ECHO Program begins here...
ECHO "<------------------>"
ECHO.
ECHO.

Rem Target TCL Engine
Rem Example: Using ActiveTCL
set engine=c:\Tcl\bin\tclsh85.exe

Rem Start folder where TCL file is located
Set folderpath=C:\...\Programs\

Rem Run the TCL program via the engine
%engine% %folderpath%%1

ECHO.
ECHO.
ECHO "<------------------>"
ECHO Program ends here...

Rem Waiting for user to press a key to quit
Pause

Enjoy!


AMG: I suggest associating *.tcl files with tclsh85.exe.

aricb: I second that suggestion. Also, if you haven't tried using Tcl interactively, you should. See An Interactive Approach to Experimenting with Tcl for more info. In an interactive Tcl session, you can load a saved script using the [source] command.