Table of Contents


tkrun - automatic GUI builder and frontend to run shell scripts or programs


tkrun [-option value...] script


tkrun presents an interactive graphical user interface to a shell script or program that conforms to a ‘‘key=val’’ interface. It does this by extracting named keywords from the shell script and building a Tcl/Tk run script that provideds the interface to running the script itself (or any program for that matter, see the -r option below).


The following options parameters are recognized (the ones with a * still have to be implemented):
-r run_path
Override default name of executable to run in the tk-script Should be in your $PATH. (Default: script).
-t tk_path
Override default name of the tk script to run at the end of tkrun (Default: in the local directory).
-w wish_path
Override location and name of the wish(1) executable. Should be in your $PATH. (Default: wish).
Do not run the script, merely create the Tcl/Tk script.
Show an example/template. Serves as a reminder how to create a new script from scratch.
* Cleanup the script after done (maybe reverse the logic here, and cleanup by default; currently no cleanup is done)
* Autorun the script after each change. (toggle button on menu?)
* Do not use keywords that have no value in running the program.
* A bit of inline help


The following tags are recongized GUI builders, using #> at the start of a line to mark a keyword
    #> ENTRY    key=val
    #> SCALE    key=val     from:to:step
    #> RADIO    key=val     opt1,opt2,opt3,...
    #> CHECK    key=val     opt1,opt2,opt3,...
    #> IFILE    key=val     
    #> OFILE    key=val
    #<      -tkopt1 tkval1 -tkopt2 -tkval2 ... 
    #> HELP  key    One-line helpers for this particular keyword
    #> -EXEC
    #           any code inbetween here is not executed by tkrun
    #> +EXEC
It is also possible to put these lines on the same line as the shell variable in e.g. c-shell scripts, e.g.:
    set a=1    #> SCALE  a=1     0:10:0.1
but this is a new feature and will possibly be modified to not have to specify the variable setting "a=1" twice.


Resetting (right click on the keyword) a checkbutton doesn’t work properly.

checkbuttons and radiobuttons do not layout their buttons efficiently, and the overal layout is limited to fit your (vertical) screensize. Planned fix is to use the grid(3) geometry manager, instead of pack(3) .

The additional Tcl/Tk options (on a #< line immediately following the #> line) are not working.

The code is horribly non-defensive, and does not handle syntax errors on the #> tag lines very well.


Help is not implemented yet. Neither is the -EXEC/+EXEC section to block out sections of the script.

See Also

wish(1)    Home Page of Tcl/Tk (now outdated)        Archive of Tcl/Tk tools    Current home page and source code repo


    % tkrun design
Would create a Tcl/Tk script called ‘‘’’, extract keyword info and run this script, which in turn will call ‘‘design’’ with your selection of ‘‘keyword=value’’ pairs.
    % tkrun -r tsf itemize.csh
parses the GUI elements from itemize.csh, and will call the tsf program.

Here is a very simple script, called testscript in the source code distribution:

#! /bin/csh -f
#       here are some basic GUI elements
#>  IFILE   in=
#>  OFILE   out=
#>  ENTRY   eps=0.01
#>  RADIO   mode=gauss              gauss,newton,leibniz
#>  CHECK   options=mean,sigma      sum,mean,sigma,skewness,kurtosis
#>  SCALE   n=3.141592              0:10:0.01
#<          -digits 2
#        parse named arguments
foreach a ($*)
   set $a
#>  -EXEC
echo If this is executed, tkrun does not work properly yet
#>  +EXEC
echo ARGS: in=$in out=$out eps=$eps mode=$mode options=$options n=$n
echo 0 : $0
set count=0
  if ($#argv == 0) exit 0
  @ count++
  echo $count :
  shift argv
  goto again


Peter Teuben ( Astronomy Department,University of Maryland,College Park,MD,USA)


~/.tkrunrc    (optional) global configuration file
$run.key    keyword file in which key=val pairs are maintained

Update History

18-aug-97    V0.1 released for ADASS97 paper (tcl/tk 7.6/4.2)     PJT
30-jan-98    V0.2 added -e, and some minor features    PJT
22-apr-04    V1.2 added option to share the set and #> comment on one line    PJT
12-jun-08    V1.4 updated doc and minor code cleanup    PJT
24-dec-09    V1.7 implemented the load/save of key=val files        PJT

Table of Contents