PROGRAM AutoBatch(Input,Output,Batch_File);(*             AutoBatch          by Erik C. Warren    Started     :  21 July, 1986    Finished    :  21 July, 1986    Last Updated:  18 December, 1986                   by Erik Warren              ________  -------Public Domain Software-------              ________  Pascal Library Copyright (C) 1986  Kyan Software, Inc.              ________   The include files are from Kyan's  System Utilities Toolkit.              ___________________UPDATE HISTORY_____________ **V1.00 / 21 July, 1986  Update Author:  Erik Warren  Modifications:    This was the first version.**V1.01 / 23 July, 1986  Update Author: Erik Warren  Modifications:    The key debounce rate was too fast    with the value 6, so I changed it    to 25; useless comments deleted;    update CONSTants made for use by    authors of future modifications;    String length 38 for WRITE; KIX    command interface, albeit kludgy.**V1.02 / 18 December, 1986  Update Author:  Erik Warren  Modifications:    The source code has been shortened    significantly--most of the routines    are now in include files; the    Pascal code now looks better and    is better programmed (localizing);    the wimpy KIX command interface has    been trashed; the command list file    concept has also been implemented.______________________________________*)  CONST        Version = 'V1.02';       Mod_Date = '18 December, 1986';     Mod_Author = 'Erik Warren';(* If you change my precious source code you &#@! well better change the   above constants! *)        MaxCmds = 18; TYPE     PathString = ARRAY[1..20] OF Char;  VAR     CmdList : ARRAY[1..MaxCmds] OF PathString;(* Now here come the commands, most included from disk (System Utilities): *)#i AddDev.i (* Add Device [Dn:] procedure       *)#i Break.i (* Enable/Disable Break key proc's  *)PROCEDURE Clear_Screen;   BEGIN       WRITE(CHR(125));END;(* Clear_Screen                  *)#i Colors.i (* Screen Color-Setting procedures  *)#i Copy.i (* Copy file function               *)#i Cursor.i (* Enable/Disable Cursor procedures *)#i Delete.i (* Delete file function             *)#i FinScrol.i (* Enable/Disable FineScroll proc's *)#i IOBeep.i (* Enable/Disable IO Beep proc's    *)#i KeyClick.i (* Enable/Disable KeyClick proc's   *)#i Lock.i (* Lock file function               *)#i Margins.i (* Set Left/Right Margins proc's    *)#i Repeat.i (* Repeat Rate control procedures   *)#i Unlock.i (* Unlock file function             *)PROCEDURE Wait;CONST     Start = 6;  VAR     Console : ^Integer;BEGIN  Console := Pointer(-12257);  REPEAT  UNTIL Console^ = StartEND;(* Wait procedure                *)PROCEDURE Inc(VAR Incee: Integer; Incer : Integer);(* classic param. names! *)BEGIN  Incee := Incee + IncerEND;(* Modula-2ish increment proc.   *)PROCEDURE Info;BEGIN  Clear_Screen;  Set_Left_Margin(0);  Set_Right_Margin(38);  WriteLn;  WriteLn;  WriteLn('                AutoBatch');  WriteLn('   Copyright (C) 1986  Erik C. Warren');  WriteLn('      Version : ',Version);  WriteLn('Last modified : ',Mod_Date);  WriteLn('...by ',Mod_Author);  WriteLn('        _________________________');  WriteLnEND;(* of printing information *)PROCEDURE Read_Commands_File;CONST     Commands_Filename = 'D:*.ACF';  VAR     Commands_File : Text;             Index : Integer;BEGIN  Index := 0;  Reset(Commands_File, Commands_Filename);  WHILE NOT EoF(Commands_File) DO    BEGIN      Inc(Index,1);      ReadLn(Commands_File, CmdList[Index])    END;(* WHILE *)END;(* Read Commands File *)PROCEDURE Read_Batch_File;CONST     Batch_Filename = 'D:*.BAT'; TYPE     TextString = ARRAY[1..38] OF Char;     Param_Rec  = RECORD                     Value : Integer;                    Action : Char;                       Txt : TextString;                    String : ARRAY[1..2] OF PathString                  END;  VAR     Batch_File : Text;         Status : Integer;        Command : PathString;          Param : Param_Rec;BEGIN  Status := 1;  Command := '                    ';  Param.Value := 0;  Param.Action := '*';  Param.Txt := '                                      ';  Param.String[1] := Command;  Param.String[2] := Command;  Reset(Batch_File, Batch_Filename);  WHILE NOT EoF(Batch_File) DO    BEGIN      ReadLn(Batch_File, Command);      IF Command = CmdList[1] THEN        BEGIN          ReadLn(Batch_File, Param.Value);          Set_Background_Color(Param.Value)        END;      IF Command = CmdList[2] THEN        BEGIN          ReadLn(Batch_File, Param.Value);          Set_Border_Color(Param.Value)        END;      IF Command = CmdList[3] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '-' THEN Disable_Break ELSE Enable_Break        END;      IF Command = CmdList[4] THEN Clear_Screen;      IF Command = CmdList[5] THEN        BEGIN          ReadLn(Batch_File, Param.String[1]);          ReadLn(Batch_File, Param.String[2]);          Status := Copy(Param.String[1], Param.String[2])        END;      IF Command = CmdList[6] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '-' THEN Disable_Cursor ELSE Enable_Cursor        END;      IF Command = CmdList[7] THEN        BEGIN          ReadLn(Batch_File, Param.String[1]);          Status := Delete(Param.String[1])        END;      IF Command = CmdList[8] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '+' THEN Fast_Key_Repeat ELSE Normal_Key_Repeat        END;      IF Command = CmdList[9] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '+' THEN Enable_Fine_Scroll ELSE Disable_Fine_Scroll        END;      IF Command = CmdList[10] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '-' THEN Disable_IO_Beep ELSE Enable_IO_Beep        END;      IF Command = CmdList[11] THEN        BEGIN          ReadLn(Batch_File, Param.Action);          IF Param.Action = '-' THEN Disable_Key_Click ELSE Enable_Key_Click        END;      IF Command = CmdList[12] THEN        BEGIN          ReadLn(Batch_File, Param.Value);         Set_Left_Margin(Param.Value)        END;      IF Command = CmdList[13] THEN        BEGIN          ReadLn(Batch_File, Param.String[1]);          Status := Lock(Param.String[1])        END;      IF Command = CmdList[14] THEN        BEGIN          ReadLn(Batch_File, Param.Value);          Set_Char_Luminance(Param.Value)        END;      IF Command = CmdList[15] THEN        BEGIN          ReadLn(Batch_File, Param.Value);          Set_Right_Margin(Param.Value)        END;      IF Command = CmdList[16] THEN        BEGIN          ReadLn(Batch_File, Param.String[1]);          Status := Unlock(Param.String[1])        END;      IF Command = CmdList[17] THEN Wait;      IF Command = CmdList[18] THEN        BEGIN          ReadLn(Batch_File, Param.Txt);          WriteLn(Param.Txt)        END;      IF Status = 136 THEN Status := 1;      (* no biggie; let the EOF slide *)      IF Status <> 1 THEN (* error time! *)        BEGIN          WriteLn(' AutoBatch: Error #',Status,' @ ',Command);          WriteLn(' Ignoring error and continuing...');          WriteLn(' (press [BREAK] to stop.');          Status := 1        END (* Error report *)    END; (* WHILE loop *)END;(* Read Batch File *)(*___________________________________*)BEGIN (* Main program module *)  Info;  Read_Commands_File;  Read_Batch_File;  WriteLn;  WriteLn('AutoBatch operations complete.');  WriteLnEND.(* of the whole enchilada *)