REPLY - The tiny shell script user interface (DOS & UNIX).
Reply yields basic interaction for batch and script files, like simple menus or input lines, drawn on a colored background with random fill patterns (if desired). The program works on a line-by-line basis. See Gerolf Markup Shredder (text mode interface) for an example of usage.
Reply is copyright (c) 1991–2006 by G. D. Brettschneider (domain: www.Gerolf.org ).
reply [mode] [line] [text] [hotkey] [item]
[mode]
can be one of the following:
-random
: Draw screen background with random
pattern-banner
: Write [text]
on the screen-top
: Draw top border of a box-item
: Write [text]
into a box-question
: Write [text]
into a box and answer
to a file-bottom
: Draw bottom border of a box-shadow
: Draw a shadow
below the box-stripe
: Draw a [text]
colored stripe of
[hotkey]
-background
: Draw a [text]
colored background
of [hotkey]
-clear
: Overwrite a line with spaces-sleep
: Delay for one second (DOS onnly)-time
: Measure time (in seconds)[line]
: Number of a line to be drawn on the screen[text]
: Text to be shown as a menu item or question[hotkey]
: Letter to be highlighted in a menu item[item]
: Number of an item within the menuReply command line invocation might look like this:
reply -banner 1 "CoolProg" reply -random 2 reply -top 7 "+-------+" reply -item 8 "Your name" reply -question 9 "Gerolf B." N 3 reply -item 10 "Get money" M 2 reply -item 11 "Exit now!" XX 1 reply -bottom 12 "+-------+" reply -shadow 13 reply -stripe 1 8 36 reply -background 2 8 36 reply -clear 7
Reply must be called from a shell script, multiple times in sequence, in
order to build a menu or dialog box. If the hotkey
parameter is
doubled, Reply displays a highlighted line and waits for user input.
The answer, in terms of environment variable settings, is written to a
temporary batch or shell file, which can be executed by the
menu-building script (from within a loop). This is a work-around for the
problem that a running program cannot change its own environment.
A few additional environment variables must be defined before running Reply; so the number of parameters passed to Reply can be kept smaller:
REPLY_AFTER
: Number of secondsREPLY_BEFORE
: Number of secondsREPLY_ITEMS
: Number of menu itemsREPLY_OFFSET
: Horizontal offset of dialog boxREPLY_SIZE
: Width of dialog box, or height of backgroundREPLY_MODULE
: Name of script to be calledREPLY_ACTION
: Name of action to be executedREPLY_HOT
: Hot key pressed be the userREPLY_COLD
: Last hot keyREPLY_TEMP
: Name of temporary answering scriptREPLY_DESKTOP
: Number of desktop color (0...7)REPLY_PATTERN
: Number of pattern color (0..15)REPLY_BANNER
: Number of banner color (0...7)REPLY_TEXT
: Number of text color (0..15)REPLY_SHADE
: Number of shadow color (0...7)REPLY_HOTKEY
: Number of hotkey color (0..15)Reply is portable to both DOS and Unix. The source code is written in ANSI C.
gcc -o reply reply.c -Lstring 2> reply.log
mk_reply
script. By default, Reply will output ANSI escape sequences for color adjust
and cursor movement. The keyboard driver must be set to one character at a time
mode by saying stty
raw
-echo
before
running Reply (and stty
-raw
echo
afterwards).bcc -o reply reply.c -Lstring -DCONIO
CONIO
must be defined
because the ansi.sys
driver for the command shell usually isn't
installed in config.sys
; so Reply makes use of the
conio.h
functions instead.You can send bug reports, corrections or suggestions to: MarkupShredder(at)Gerolf.org, subject: GMS REPLY user interface.
Copyright (c) 1991-2006 by Gerolf Diethelm Brettschneider, Luchtbergstraße 27, D-28237 Bremen. All rights reserved. This software comes without any warranty. You may freely distribute and use it.
G. D. Brettschneider (2006) – www.Gerolf.org