UnixDos advanced interactive
Text Viewer (TXTBOX)ud_lo.gif (12165 bytes)

Description

TXTBOX allows you to open text files of any size and view it in a user friendly environment.
Command line options allow you to excactly tailor the behaviour.
TXTBOX also offers the optional interactive Button Mode so that you display information and then directly
process in a batch script the user response based on which button is clicked.

TXTBOX1

TXTBOX offers the following features:

Unlimited file size
maximum line length is 10,000 characters
horizontal scrolling
vertical scrolling
line number display toggle
goto specified line
complete restore of all parameter after exit
(filename, windows position, search parameter, current line, colors, fonts ...)
regular expression and straight text search
automatic wrap option for searches
ignore case option for searches
color selection for text and background
font selection for text display
initial position device independent using percent instead of pixels
total line count and file size display
optional button feature to allow user to select choices
complete control via command line options (see below)
no disturbing wrapping of long lines
exit code depending on user response
(0=exit, 1=button1, 2=button2, 3=button3, 99=error)
(allowing you to implement TXTBOX in batch files for decisions and branching)
storage of exit code in special file for later retrieval

TXTBOX Button Mode

TXTBOX allows you to display the text and then allow the user to respond by pressing a button.
You can specify 1 to 3 buttons with your custom text. The buttons are displaye below the text centered to the window.
Each text for a button can be up to 16 characters long.
You can specify that a response via the button click is required (-B) or leave it optional (-b)

Example:
Below you can see two buttons “Accept” and “Don’t accept”.
This is achived by the command line option (the quites are needed to include spaces and pipe):
txtbox “-bAccept|Don’t Accept”

TXTBOX2

To make the button selection required use the capital B:
txtbox “-BAccept|Don’t Accept”

To switch the button default off again use the empty -b switch:
txtbox -b

TXTBOX Command line options

txtbox [options] [file]
options: (can be used in any sequence)
+{n}     = Number : start display from line number {n}
-b[t1[|t2[|t3]]
         = Button : define up to three buttons not required
                    t1 = text for button1

                                                  t2 = text for button2
                    t3 = text for button3
-B[t1[|t2[|t3]]
        = Button : define up to three buttons click required!
                    t1 = text for button1

                                                  t2 = text for button2
                    t3 = text for button3
-ct{clr} = ColorTxt: define color for text
                    clr = RGB(red,green,blue) (0-255) or
                    clr = black,red,green,blue,yellow,cyan,magenta,white,grey,orange
-d = Default : restore all defaults
(should be in the beginning)
-e{fn} = ExitCode: specify the file to store the exit code:
                    0 = regular exit
                    1 = button1 clicked
                    2 = button2 clicked
                    3 = button3 clicked
                    1XX= error
                   by default code in: %TEMP%\txtbox.tmp
-f{p,n,w,i}= Font : use specified font for text:
                    p = point size (1 - 100)
                    n = font name
                    w = weight (100-999) bold=700, regular=400
                    I = italic (0=off, 1=on)
-h{hd} = Header : use ‘hd’ as header for TXTBOX:
                  the following special command are available:
                    &B = current filesize
                    &C = current column offset
                    &E = current maximum line length
                    &F = current filename
                    &L = current line number
                    &M = current total number of lines
-l{0|1} = LineNbr : show line numbers -l0=off, -l1=on
-o{Col} = Column : goto column ‘Col’ (default is 0=first column)
-p{x,y,cx,cy}
        = Position : open window at position:
                     all values are in percent (0-100) allowing you
                     completely device independent positioning!
                    x = upper left corner horz position in percent
                    y = upper left corner vert position in percent
                    cx = width in percent
                    cy = height in percent
-s{c,l} = Scroll : define overlapping Scroll parameter
                    c = cols to keep for page left/right scroll
                        (0=no overlap, 1-80=cols, 10=default)
                    l = lines to keep for page up/down (1)
                        (0=no overlap, 1-30=lines, 1=default)
-t{n} = Tab : set number of space for TAB character (default 8)

[file] = file to be viewed initially (can be placed anywhere also between options)
(no file is OK, screen will just be blank)

Example1 (button - optional):
This example will display file ‘\temp\oldlog,.txt’ with two button below “Delete” and “Keep”.
The Text is displayed in blue with yellow background.
txtbox “-bDelete|Keep” \temp\oldlog.txt -ctBlue -cbYelloW

Example2 (button - required, interactive, exit code):
To make example1 part of an interactive batch file prompting the user if the file should be deleted with a required response:
wait_end txtbox "-BDelete|Keep" \temp\oldlog.txt -ctBlue -cbYelloW
call saveexit
test -e 1 run: banner delete

WAIT_END will execute the specified program but wait until it is complete!
SAVEEXIT will save the last error level for later retrieval and TEST.EXE.
TEST is testing the expression (in this case the last exit code) and executing the specified program,
you could also use IF ERRORLEVEL {n}.

Example3 (loading a font):
You can select an existing font already at the command line.
In this example we use “Times New Roman” with point size 15 and bold weight (700) in italc:
txtbox \temp\oldlog.txt “-f15,Times New Roman,700,1”

Note the double quotes around the font option in order to pass the following arguments into TXTBOX
as ONE argument (not broken up into several arguments)

Example4 (show lines, use header, start at a line):
In this exmaple we switch the line number display on, start at line 893 and use a custom header:
txtbox -l1 +893 “-hFile: %F at line %l or %m” \temp\oldlog.txt

Note the double quotes around the header option in order to pass the following arguments into TXTBOX as
ONE argument (not broken up into several arguments)

Example5 (window positioning,column offset,scroll parameter):
In this exmaple we will request a specific position on the screen:
Upper left hand corder at left egde and in the middle of the screen. (0,50)
Width is 70% of the screen and height is 40%.
The display will start at column 40 and use no overlap for line sor columns:
txtbox -p0,50,70,40 -c40 -s0,0

Note that we don’t specify any filename in which case TXTBOX will use automatically.the filename from the last session.

Example6 (reset):
Sometimes you want to start from scratch; remove all the previous settings.
For this situation the ‘-d’ option has been included, which will wipe a clean slate and only add the options you specify to the internal default:
txtbox -d -p0,50,70,40 -c40 -s0,0

Note the parameter from the last session is stored in the same directory where TXTBOX has been stored in the file TXTBOX.DAT. So if you want to maintain several sets of defaults you can store and restore this file at the times you need them.