This HTML automatically generated with rman for NEMO
Table of Contents

Name

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

programs

Synopsis

tkrun [-option value...] script

Description

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).

Options

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: script.tk in the local directory).
-w wish_path
Override location and name of the wish(1) executable. Should be in your $PATH. (Default: wish).
-x
Do not run the script, merely create the Tcl/Tk script.
-e
Show an example/template. Serves as a reminder how to create a new script from scratch.
-c
* Cleanup the script after done (maybe reverse the logic here, and cleanup by default; currently no cleanup is done)
-a
* Autorun the script after each change. (toggle button on menu?)
-n
* Do not use keywords that have no value in running the program.
-h
* A bit of inline help

Script

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
    #> IDIR     key=val     
    #> ODIR     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.

In the upcoming tkrun V2 version of this format is expected to allow help, as well as normalize the keyword specification as follows:

    set a=1   # some help on this keyword        #> SCALE  0:10:0.1

Caveats

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.

Examples

With the -e flag a very simple example can be created:
    % tkrun -e > try1.csh
    % chmod +x try1.csh
    % tkrun ./try1.csh

And more:


    % tkrun design
Would create a Tcl/Tk script called ‘‘design.tk’’, 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
end
#>  -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 TESTSCRIPT
echo 0 : $0
set count=0
again:
  if ($#argv == 0) exit 0
  @ count++
  echo $count :
  shift argv
  goto again

Tkrun V2

In version 2 of this format we have implemented this via a new python based qt (and pySimpleGui) driver. Here the format can be run via bash, csh and python in the
    key=val  # help    #> GUI
specification, but the client software (bash/csh/python/....) is responsible to properly parse the key=val command line arguments. Here are the proposed

GUI tags with generic key=val/help sections


   in=foo        # input file      #> IFILE
   out=bar       # output file     #> OFILE
   text=hello    # some text       #> ENTRY
   mode=gauss    # the mode        #> RADIO gauss,newton,leibniz
   stats=mean    # what to show    #> CHECK sum,mean,sigma,skewness,kurtosis
   n=3.141592    # the n value     #> SCALE 0:10:0.01
   k=3.141592    # k, use n        #> LINK  n

Todo

Help is not implemented yet. Neither is the -EXEC/+EXEC section to block out sections of the script. There is a tooltip available, but not implemented since the help portion of the GUI specification in V2 has not been implemented here.

See Also

wish(1) , zenity(1) , qtrun(1NEMO)


http://sunscript.sun.com/    Home Page of Tcl/Tk (now gone)
http://www.neosoft.com/        Archive of Tcl/Tk tools 
http://tcl.sourceforge.net/    Current home page and source code repo


Author

Peter Teuben

Files


~/.tkrunrc    (optional) global configuration file
$run.key    keyword file in which key=val pairs are maintained
$NEMO/scripts/templates     example templates of key=val parsing

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
14-jul-2023    rudimentary tooltips
3-aug-2023    proposing the new V2 GUI format        PJT


Table of Contents