home *** CD-ROM | disk | FTP | other *** search
- program Menu;
- { This program creates a menu from .BAT files. For each program you wish to
- run, or other action taken, there should be a .BAT file in the directory
- c:\start. There should be a remarks line in the .BAT file which contains
- a description, 30 characters or less, of the action of the .BAT file.
- If present, it must be the first remarks line in the file. Also, your
- AUTOEXEC.BAT file must contain a PATH statement that includes the
- directory c:\start.
-
- A typical basic .BAT file would be the following:
-
- echo off
- cls
- rem Lotus 1-2-3
- c:
- cd \lotus
- lotus
-
- John Fistere
- BIX: johnf
-
- This program is placed in the public domain. In return, I would appreciate
- knowing if you find it of use to you. }
-
- uses
- Dos,Crt;
-
- var
- CrtLine,
- DotLoc : integer;
- Ref : string[20];
- DirInfo : SearchRec;
- FileNam : Text;
- Line : String[60];
- Entry : (Left,Right);
-
- begin
- ClrScr;
- GoToXY(31,2);
- TextColor(Blue);
- TextBackground(White);
- Writeln('SELECTION MENU');
- TextBackground(Black);
- Writeln('-------------------------------------------------------------------------------');
- Entry := Left;
- FindFirst('c:\start\*.bat',Archive,DirInfo);
- while DosError = 0 do
- begin
- DotLoc := Pos('.',DirInfo.Name);
- Ref := Copy(DirInfo.Name,1,DotLoc -1);
- TextColor(Yellow);
- Write(Ref);
- TextColor(Cyan);
- Assign(FileNam,'c:\start\' + DirInfo.Name);
- Reset(FileNam);
- repeat
- Readln(FileNam,Line);
- until (copy(Line,1,3) = 'rem') or (copy(Line,1,3) = 'REM')
- or Eof(FileNam);
- CrtLine := WhereY;
- if not Eof(FileNam) then begin
- if Entry = Left then
- begin
- GoToXY(10,CrtLine);
- Write(Copy(Line,5,30));
- GoToXY(41,CrtLine);
- Entry := Right
- end
- else begin
- GoToXY(50,CrtLine);
- Writeln(Copy(Line,5,30));
- Entry := Left;
- end;
- end
- else if Entry = Right then begin
- Entry := Left;
- Writeln;
- end
- else begin
- Entry := Right;
- GoToXY(41,CrtLine);
- end;
- Close(FileNam);
- FindNext(DirInfo);
- end;
- if Entry = Right then writeln;
- TextColor(Blue);
- Writeln('-------------------------------------------------------------------------------');
- TextColor(Yellow);
- Write('Type your selection at the prompt.');
- end.