or you can use this one ...


code:

cls break on dim $inboxmsg[10]


SHELL "%COMSPEC% /e:1024 /c DIR D:\spfiles\*.prn /on /b > d:\spfiles\list.txt"


$input_file = d:\spfiles\list.txt"
$custom_msg_1 = "write your custom message here. Can"
$custom_msg_2 = "be anything you like. This menu is "
$custom_msg_3 = "created from the file 'my_datatxt' "
$custom_msg_4 = "and is only a demonstration."
$custom_msg_5 = "George Bouras, netcom@@matrix.kapatel.gr"
gosub menu_box

Open(4,$final_data,2)
DO
$FileName = ReadLine(4)
$READ=$READ+1
UNTIL $READ = $LineNumber
CLOSE (4)
MESSAGEBOX ("D:\spfiles\$FileName will be printed on $Dest","File Name",64,5)
SLEEP 2


; ********************************************************************
; ********************************************************************
; ** **
; ** Here is the Repository place for my functions and Sub Routines **
; ** **
; ********************************************************************
; ********************************************************************

goto "end"

; ******************************************************
; ******************************************************
;
; Here is a subroutine to create a Selection Menu. The
: contents of the menu are taken from an input file.
; Before use this subroutine you must have indicate the
; variable $input_file and if you want a custom message
; appearing to the menu window , indicate the variables
; $custom_msg_1, $custom_msg_2, $custom_msg_3,
; $custom_msg_4, and $custom_msg_5
; Your Selection is attached to the variable
; $final_data
;
; George Bouras
; netcom@matrix.kapatel.gr
;
; ******************************************************
; ******************************************************


:menu_box setascii(on) cls break on


if open(1,$input_file,2) <>0 goto "input_file_no" endif
do
$max_lines=$max_lines+1
readline(1)
cls
until @error=-1
close(1)
dim $the_data[$max_lines+1]
goto "input_file_ok"

:input_file_no
color r+/n
cls
box(9, 16, 13,61,double)
color c+/n at(11, 19) "Fail to open Input File " $input_file
at(11, 79)
get $b_sub
goto "exit_menu_box"


:input_file_ok
$n_sub=0
open(1,$input_file,2)
do
$n_sub=$n_sub+1
$the_data[$n_sub]=readline(1)
until @error=-1
close(1) cls

;---------------- Prepare the shifting effect -------------------

$data_sub=1 $line_sub=1
$delbox=" "
color c+/b box(0,0,24,35,double)

box(0, 37,16,79,double)
box(17,37,24,79,double) color w+/b

at (19,40) "Use the Up (" chr(24) ") or Down (" chr(25) ") keys to"
at (20,40) "Navigate the menu, and space or Enter"
at (21,40) "to choose the line you want."
at (3 ,40) $custom_msg_1
at (5 ,40) $custom_msg_2
at (7 ,40) $custom_msg_3
at (9 ,40) $custom_msg_4
at (11,40) $custom_msg_5

if $max_lines=2 $max_lines=3 $z_sub=1 endif
goto "select"
:start
get $b_sub
:select
select

;----------------- going up inside the box -------------------

case $b_sub=chr(72) and $line_sub > 0

$line_sub=$data_sub-$k
$data_sub = $data_sub-1
$line_sub = $line_sub-1
color b/b at($line_sub+4 ,1) $delbox ; delete the old box

$n_sub=$line_sub+4
$m=1
do ; write previous lines
color c+/b at($n_sub ,2) $the_data[$data_sub+1+$m]
$m=$m+1
$n_sub=$n_sub+1
until $n_sub=24 or $n_sub=$max_lines+2

color y+/b box ($line_sub+1, 1, $line_sub+3,34,double) ; create new box
color y+/b at ($line_sub+2, 2) $the_data[$data_sub+1] at($line_sub+2,79) ; write new data
$final_data=$the_data[$data_sub+1]

;----------------- going down inside the box -----------------

case $b_sub=chr(80) and $line_sub<20

if $line_sub > $max_lines - 3 or $z_sub = 1 goto "do_nothing" endif

$data_sub=$data_sub+1
$line_sub=$line_sub+1
color b/b at($line_sub,1) $delbox ; delete the old box

$q_sub=1
do ; write previous lines
color c+/b at($q_sub ,2) $the_data[$q_sub+$k]
$q_sub=$q_sub+1
until $q_sub=$line_sub+2

color y+/b box ($line_sub+1, 1, $line_sub+3,34,double) ; create new box
color y+/b at ($line_sub+2, 2) $the_data[$data_sub+1] at($line_sub+2,79) ; write new data
$final_data=$the_data[$data_sub+1]
:do_nothing

;----------------- going up over the box ---------------------

case $b_sub=chr(72) and $line_sub = 0 and $data_sub > 0

$k=$k-1
$z_sub=4
do
color b/b at($z_sub,1) $delbox ; delete previous lines
color c+/b at($z_sub,2) $the_data[$data_sub+$z_sub-3] ; write previous lines
$z_sub=$z_sub+1
until $z_sub=24

color y+/b box (1, 1, 3,34,double) ; create new box
color c+/b at(2 ,2) $the_data[$data_sub] at(2,79) ; write new data
$final_data=$the_data[$data_sub]
$data_sub = $data_sub-1

;----------------- going down below the box ------------------

case $b_sub=chr(80) and $data_sub<$max_lines-2

$data_sub=$data_sub+1
$k=$k+1
$n_sub=1

$n_sub=1
do
color b/b at($n_sub,1) $delbox ; delete previous lines
color c+/b at($n_sub,2) $the_data[$n_sub+$k] ; write previous lines
$n_sub=$n_sub+1
until $n_sub=21

color y+/b box (21, 1, 23,34,double) ; create new box
color c+/b at(22 ,2) $the_data[21+$k] at(22,79) ; write new data
$final_data=$the_data[21+$k]

;----------------- selection is made -------------------------

case $b_sub=chr(13) or $b_sub=chr(32)
goto "exit_menu_box"

endselect
goto "start"
setascii(off)
:exit_menu_box
color w/n cls
return


:end
color w/n