PofoWiki

Die ultimative Informationsquelle zum ATARI Portfolio

Benutzer-Werkzeuge

Webseiten-Werkzeuge


software:diy:pascal:pascalbjg

Dies ist eine alte Version des Dokuments!


B.J. Gleason (Author von PBasic) schrieb dieses Programm in 1992, ein Artikel darüber ist in der Mai/Juni-Ausgabe von ATARI Explorer erschienen.

MENU.EXE erlaubt es Menüs in Batch-Dateien zu verwenden die genau wie Portfolio´s eingebaute Applikationen aussehen.

program batmenu;

{ this program is invoked from the command line:

           menu title item1 item2 .... itemN
      You can then choose one of the items.  The program will
      set the DOS variable ERRORLEVEL, so that you can then
      perform an action in a BATCH file with the statement:
           IF ERRORLEVEL=2 GOTO PROG2:
      returns 0 if escape is pressed, otherwise the item number
      the menu will be automatically centered on the screen.
      Written by BJ Gleason
      Copyright 1992, BJ Gleason

}

uses dos;

var

 menus : string;
 l,x,y : integer;
 regs : registers;

begin

   { read the parameters from the command line }
   { add them to the menu string }
   menus := '';
   l := 0;
   for x:=1 to paramcount do
     begin
       menus := menus + paramstr(x) + chr(0);
       if length(paramstr(x))>l then l:=length(paramstr(x));
     end;
   menus := menus + chr(0);
   for x:=1 to length(menus) do
     if menus[x]='_' then menus[x] := ' ';
   { now call the internal ROM BIOS Menu functions }
   regs.ah := $0f;
   regs.al := 65;
   regs.bh := 0;
   regs.cx := 0;
   if l<36 then x:=(40-(l+4)) div 2 else x:=0;
   if paramcount<6 then y:=(8-(paramcount+1)) div 2 else y:=0;
   regs.dh := y;
   regs.dl := x;
   regs.ds := seg(menus);
   regs.si := ofs(menus)+1;
   regs.di := $0ffff;
   intr($60, regs);
   inc(regs.ax);
   halt(regs.ax and $0ff);

end.

software/diy/pascal/pascalbjg.1158004976.txt.gz · Zuletzt geändert: 16/02/2024 17:02 (Externe Bearbeitung)