Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto Menu
#1
Just a little snippet that may be of some use to someone. It displays all BAS files in a QB Directory, which you select by name or number. Of course if you save the code as MENU.BAS it will run automatically if you invoke Qbasic or QuckBasic as

QB /l /run menu or Qbasic /run menu

REM Auto Menu
DIM N$(502)
SCREEN 12: WIDTH 80, 60: CLS : FILES "*.BAS":

R = 2: C = 1: F = 1: OK = 1

WHILE OK = 1
IF SCREEN(R, 1) = 32 THEN OK = 0: GOTO DONE
N$(F) = ""
FOR S% = C TO C + 11
A = SCREEN(R, S%)
IF A <> 32 THEN N$(F) = N$(F) + CHR$(A)
NEXT S%
IF N$(F) = "" THEN N$(F) = "||||||||||||"
F = F + 1
C = C + 18: IF C > 65 THEN C = 1: R = R + 1
DONE: WEND: F = F - 1

FOR R% = 1 TO F - 1
FOR K% = R% + 1 TO F
IF N$(K%) < N$(R%) THEN
T$ = N$(K%)
N$(K%) = N$(R%)
N$(R%) = T$
END IF
NEXT K%
NEXT R%

CLS : TB = 1
FOR D = 1 TO F
PRINT TAB(TB); D; " "; N$(D);
TB = TB + 18
IF TB > 70 THEN TB = 1
NEXT D

PRINT : PRINT : COLOR 10
PRINT " Enter the number or name of the program to RUN, ";
PRINT "or / for full list"; : INPUT Q$
IF Q$ = "/" THEN CLS : FILES "*.*": SLEEP 4: RUN
Q = VAL(Q$): IF VAL(Q$) = 0 THEN RUN Q$ ELSE RUN N$(Q): END
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)