Comment ============================================================= Copyright 1990-2000 by Marc Perkel This program is used to generate a new MarxMenu and distribute the compiled files. It is an example of how to use MarxMenu as a Job Control language. Since I'm on a network, the way I test to update a file is to delete it and then update it. If someone on the net has the file open, the delete will fail. I'm doing extensive error checking here. Errors are recorded in ErrorArray. Any errors are displayed at the end. Note that in order to read error return codes from subprograms you have to use the .EXE or .COM extentions. Otherwise MarxMenu will load COMMAND.COM and the codes will be absorbed. Don't try to run this menu! It is for reading and ideas only. ============================================================= EndComment Var MarxMenuPath ErrorArray ExecError AccessCode StandardIO UpperCaseCompare XmsOverlays EmsOverlays Swapping MarxMenuPath = Path if not ExistFile('MARXMENU.PAS') Writeln "This program can only be run on Marc Perkel's Computer!" Writeln "It is provided as an example only." ExitMenu endif CopyFile('INITYME.INC','N:') CopyFile('INITYME.HLP','N:') CopyFile('BATZAP.HLP','N:') LinkMenus ExecLine ('DEL N:*.MRX') ChDir MarxMenuPath ;------ Clean up ExecLine('ZDEL.EXE *.MAP *.OLD *.BAK') ;------ Show Errors if any if NumberOfElements (ErrorArray) > 0 Writeln 'Errors:' Loop NumberOfElements(ErrorArray) Writeln '==> ' ErrorArray[LoopIndex] EndLoop else Writeln 'No Errors!' endif ExitMenu ;========================================================= ;------ Subroutines Procedure LinkMenus LinkMenu('BINDDUMP') LinkMenu('SMITE') LinkMenu('WHOHAS') LinkMenu('WHOGOWA') LinkMenu('INITYME') LinkMenu('INIDIF') LinkMenu('TRUSTEZ') LinkMenu('BINDEZ') LinkMenu('BATZAP') LinkMenu('LONGSAVE') LinkMenu('SERVSYNC') ; LinkMenu('ATTACH') ; LinkMenu('USERLIST') ; LinkMenu('MAILCOPY') EndProc Procedure LinkMenu (St) LinkMenuFile(St) MakeZip(St,False) MakeZip(St,True) EndProc ;-------------------------------------------------------- Procedure MakeZip (St,ShareWare) var ExeSource St = UpperCase St if ShareWare ChDir 'G:\CTYME\DOWNLOAD\SHARE' ExeSource = 'N:\' else ChDir 'G:\CTYME\DOWNLOAD\REAL' ExeSource = 'U:\' endif DelFile (St + '.ZIP') ExecLine 'U:\PKZIP.EXE ' St ' ' ExeSource St '.EXE N:\' St '.MNU N:\ADDRESS.INC' if ExistFile ('N:\' + St + '.INC') ExecLine 'U:\PKZIP.EXE ' St ' N:\' + St + '.INC' endif if ExistFile ('N:\' + St + '.HLP') ExecLine 'U:\PKZIP.EXE ' St ' N:\' + St + '.HLP' endif EndProc Procedure CopyMarxFile (Source,Dest) var TargetFileName if Right(Dest,1) <> ':' TargetFileName = CleanFileName(Dest + '\' + Source) else TargetFileName = CleanFileName(Dest + Source) endif DelFile(TargetFileName) if ExistFile(TargetFileName) WriteErrorMsg('File ' + Source + ' Failed to copy to ' + TargetFileName + '!') else ExecLine('YCOPY.EXE ' + Source + ' ' + TargetFileName) endif EndProc Procedure ModifyMenu (Name,Shareware) var Lines St Name = Name + '.MNU' ReadTextFile(Name,Lines) Loop Lines St = LoopVal Trim(St) if St Contains '#DEFINE SHAREWARE' if Shareware LoopVal = '#Define Shareware' else LoopVal = ';#Define Shareware' endif endif if St Contains '#DEFINE MARXERRORS' LoopVal = ';#Define MarxErrors' endif EndLoop WriteTextFile(Name,Lines) EndProc Procedure LinkMenuFile (Name) ChDir MarxMenuPath Writeln Writeln 'Creating Shareware ' NAME Writeln ModifyMenu(Name,True) ExecLine ('MARXLINK.EXE ' + Name) ExecLine ('N:\MOVE.EXE ' + Name + '.EXE N:') Writeln Writeln 'Creating Registered ' NAME Writeln ModifyMenu(Name,False) ExecLine ('MARXLINK.EXE ' + Name) ExecLine ('YCOPY.EXE ' + Name + '.EXE P:\MARXUTIL') ExecLine ('N:\MOVE.EXE ' + Name + '.EXE U:') CopyFile (Name + '.MNU','N:') EndProc Procedure ExecLine ($St) AbortGen Writeln '==> ' St Execute (St) ExecError = ReturnCode <> 0 if ExecError WriteErrorMsg ('Error ' + Str(ReturnCode) + ' while Executing: ' + St) endif Writeln EndProc Procedure WriteErrorMsg (St) Writeln (Char(7) + '==> Error: ' + St) ErrorArray[NumberOfElements(ErrorArray) + 1] = St Wait 300 EndProc Procedure AbortGen var Ch if not KbdReady then return Ch = ReadKey if Ch = Esc then ExitMenu EndProc