What follows is a script to list files to be printed. Using a shell I am able to create a list of files and the show them to the user that will make the final selection of which one to print.
The problem is that the command prompt screen has a constrain on how many lines can be presented. That's why I limited the lines to be shown to 15, no more.
The user must select from the available files by selecting the line number. Here is the other problem: in the line that's supposed to limit the selection between 1 and 15, I am able to type numbers greater than those and the script file continues to work when it should send the message to select only between 1 and 15.
Any ideas what's going on? How to solve it?
Thanks.

;CODE BEGINS
BREAK ON
COLOR W+/B
CLS
$L = 1
$COUNT = 0

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

IF Open(3, "D:\spfiles\list.txt",2) = 0
$x = ReadLine(3)
WHILE @ERROR = 0 AND $COUNT < 15
$COUNT=$COUNT+1
at ( 5+$count,0)? "File " $L " is: " + $X + " "
$X = ReadLine(3)
$L = $L + 1
LOOP
CLOSE (3)
ELSE
BEEP
? "File not opened, error code: [" + @ERROR + "]"
ENDIF

:FILENAME
BOX ( 0,9,5,68,SINGLE)
AT ( 2,12) "Select Line Number of File To Print"
AT ( 3,12) "Line Number is: "
GETS $LineNumber
IF $LineNumber = ""
MESSAGEBOX ("You MUST Type The Line Number of the File To Print.","File Name",64,5)
@ERROR = 0
ENDIF
IF $LineNumber =>1 or $LineNumber =<15
ELSE
MESSAGEBOX ("Please Select Line Number Between 1 and 15","File Name",64,5)
GOTO FILENAME
ENDIF

Open(4, "D:\spfiles\list.txt",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
;CODE ENDS