Comment ============================================================= Copyright 1990-1999 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 ThisPath ErrorArray ExecError CompName TargetDir Shareware RegFile Divorce Shareware = UpperCase(ParamStr(2)) = 'S' StandardIO ClearScreenFirst Off ThisPath = CurrentDirectory ;GenDoc('BESTNET') ;exitmenu CompName = ExistOnPath('TPC.EXE') if CompName = '' Writeln('Compiler not Found!') ExitMenu endif CompName = CompName + ' /M/Q' ReadTextFile ('REG.PAS',RegFile) if ShareWare RegFile[1] = '{$DEFINE SHAREWARE}' else RegFile[1] = '{.$DEFINE SHAREWARE}' endif WriteTextFile ('REG.PAS',RegFile) CompileTBFile('BESTNET') CompileTBFile('D') CompileTBFile('DOHELP') CompileTBFile('FIND') CompileTBFile('FIXPATH') CompileTBFile('FORK') CompileTBFile('FREE') CompileTBFile('GRPTYME') CompileTBFile('KBD') CompileTBFile('LOGOFF') CompileTBFile('MORE') CompileTBFile('MOVE') CompileTBFile('PD') CompileTBFile('PIPEDIR') CompileTBFile('RAMMAP') CompileTBFile('SIEVE') CompileTBFile('SORT') CompileTBFile('XMETER') CompileTBFile('CLEANTXT') CompileTBFile('ZDEL') CompileOvrTBFile('DOLIST') CompileOvrTBFile('MOREHAND') CompileOvrTBFile('VERSION') CompileOvrTBFile('COMSP') if ShareWare ExecLine('COPY PIPEDIR.EXE WHEREIS.EXE') ExecLine('COPY RAMMAP.EXE INMEM.EXE') GenDoc('BESTNET') GenDoc('COMSP') GenDoc('D') GenDoc('DOLIST') GenDoc('FIND') GenDoc('FIXPATH') GenDoc('FORK') GenDoc('FREE') GenDoc('GRPTYME') GenDoc('INMEM') GenDoc('KBD') GenDoc('LOGOFF') GenDoc('MORE') GenDoc('MOREHAND') GenDoc('MOVE') GenDoc('PD') GenDoc('PIPEDIR') GenDoc('RAMMAP') GenDoc('SORT') GenDoc('VERSION') GenDoc('WHEREIS') GenDoc('XMETER') GenDoc('CLEANTXT') GenDoc('ZDEL') else ExecLine('COPY PIPEDIR.EXE WHEREIS.EXE') ExecLine('COPY RAMMAP.EXE INMEM.EXE') TargetDir = 'N:\' CopyAFile('BESTNET') CopyAFile('COMSP') CopyAFile('D') CopyAFile('DOHELP') CopyAFile('FIND') CopyAFile('FIXPATH') CopyAFile('FORK') CopyAFile('FREE') CopyAFile('GRPTYME') CopyAFile('INMEM') CopyAFile('KBD') CopyAFile('LOGOFF') CopyAFile('MORE') CopyAFile('MOREHAND') CopyAFile('MOVE') CopyAFile('PD') CopyAFile('PIPEDIR') CopyAFile('RAMMAP') CopyAFile('SIEVE') CopyAFile('SORT') CopyAFile('VERSION') CopyAFile('WHEREIS') CopyAFile('XMETER') CopyAFile('CLEANTXT') CopyAFile('ZDEL') DelFile('N:\DOLIST.EXE') if not ExistFile('N:\DOLIST.EXE') CopyAFile('DOLIST') endif endif if ExistDir 'P:\TOOLBOX' if ShareWare TargetDir = CleanDir('P:\SHTOOL') MoveFile('D') MoveFile('PIPEDIR') MoveFile('FREE') else TargetDir = CleanDir('P:\DISK2') MoveFile('D') MoveFile('PIPEDIR') MoveFile('FREE') TargetDir = CleanDir('P:\TOOLBOX') endif MoveFile('DOHELP') MoveFile('DOLIST') MoveFile('FIND') MoveFile('FORK') MoveFile('KBD') MoveFile('MORE') MoveFile('MOVE') MoveFile('PD') MoveFile('RAMMAP') MoveFile('SORT') MoveFile('VERSION') MoveFile('ZDEL') if ShareWare TargetDir = CleanDir('P:\SHNSK') else TargetDir = CleanDir('P:\REALNSK') endif MoveFile('BESTNET') MoveFile('FIXPATH') MoveFile('GRPTYME') MoveFile('LOGOFF') MoveFile('SIEVE') MoveFile('XMETER') MoveFile('CLEANTXT') MoveFile('MOREHAND') MoveFile('COMSP') if Shareware if ExistDir 'F:\BBS\DLOADS\TYMESOFT' ExecLine ('NCOPY.EXE \PUBLIC\SHTOOL\*.* F:\BBS\DLOADS\TYMESOFT') ExecLine ('NCOPY.EXE \PUBLIC\SHNSK\*.* F:\BBS\DLOADS\TYMESOFT') ExecLine ('NCOPY.EXE *.DOC F:\BBS\DLOADS\TYMESOFT') ExecLine ('NCOPY.EXE *.EXE F:\BBS\DLOADS\TYMESOFT') ChDir('F:\BBS\DLOADS\TYMESOFT') ExecLine ('D /F *.ZIP|N:DOLIST.EXE PKZIP -F @L') ExecLine ('NCOPY.EXE *.DOC F:\HTML\DOWNLOAD\SHARE') ExecLine ('NCOPY.EXE *.EXE F:\HTML\DOWNLOAD\SHARE') ChDir('F:\HTML\DOWNLOAD\SHARE') ExecLine ('D /F *.ZIP|N:DOLIST.EXE PKZIP -F @L') endif else if ExistDir 'F:\PUBLIC\TOOLBOX' ChDir('F:\PUBLIC\TOOLBOX') ExecLine ('ZIP.EXE -EX TOOLBOX *.*') ExecLine ('ZIP2EXE.EXE -J TOOLBOX') ExecLine ('ZDEL.EXE TOOLBOX.ZIP') ExecLine ('MOVE.EXE TOOLBOX.EXE \PUBLIC\SOFTWARE') ChDir('F:\PUBLIC\DISK2') ExecLine ('ZIP.EXE -EX DISK2 *.*') ExecLine ('ZIP2EXE.EXE -J DISK2') ExecLine ('ZDEL.EXE DISK2.ZIP') ExecLine ('MOVE.EXE DISK2.EXE \PUBLIC\SOFTWARE') endif if ExistDir 'F:\BBS\DLOADS\SPECIAL' ChDir(ThisPath) ExecLine ('NCOPY.EXE F:\PUBLIC\TOOLBOX\*.* F:\BBS\DLOADS\SPECIAL') ExecLine ('NCOPY.EXE F:\PUBLIC\REALNSK\*.* F:\BBS\DLOADS\SPECIAL') ExecLine ('NCOPY.EXE F:\PUBLIC\DISK2\*.* F:\BBS\DLOADS\SPECIAL') ExecLine ('NCOPY.EXE *.DOC F:\BBS\DLOADS\SPECIAL') ExecLine ('NCOPY.EXE *.EXE F:\BBS\DLOADS\TYMESOFT') ChDir('F:\BBS\DLOADS\SPECIAL') ExecLine ('D /F *.ZIP|N:DOLIST.EXE PKZIP -F @L') ExecLine ('NCOPY.EXE *.DOC F:\HTML\DOWNLOAD\REAL') ExecLine ('NCOPY.EXE *.EXE F:\HTML\DOWNLOAD\REAL') ChDir('F:\HTML\DOWNLOAD\REAL') ExecLine ('D /F *.ZIP|N:DOLIST.EXE PKZIP -F @L') endif endif endif ChDir(ThisPath) ExecLine ('N:ZDEL.EXE *.BAK') ExecLine ('N:ZDEL.EXE *.EXE') ExecLine ('N:ZDEL.EXE *.DOC') ExecLine ('N:ZDEL.EXE *.TPU') ExecLine ('N:ZDEL.EXE *.MAP') ExecLine ('N:ZDEL.EXE *.OVR') ExecLine ('N:ZDEL.EXE *.OLD') ;------ 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 CleanDir (Name) if ExistDir(Name) Return Name else Return '' endif EndProc Procedure MoveFile (Name) if TargetDir = '' then Return ExecLine('N:MOVE.EXE ' + Name + '.EXE ' + TargetDir) EndProc Procedure CopyAFile (Name) if TargetDir = '' then Return Writeln '==> Copying ' Name ' to ' TargetDir ' ...' Writeln CopyFile(Name + '.EXE',TargetDir) EndProc Procedure CompileTBFile (Name) Writeln '==> Compiling ' Name ' ...' Writeln ExecLine(CompName + ' ' + Name) ExecLine('LZEXE.EXE ' + Name) EndProc Procedure CompileOvrTBFile (Name) Writeln '==> Compiling ' Name ' ...' Writeln ExecLine(CompName + ' ' + Name) ExecLine('COPY /B ' + Name + '.EXE + ' + Name + '.OVR') EndProc Procedure MakeZip (Name) DelFile(Name + '.ZIP') ExecLine('ZIP.EXE ' + Name + ' ' + Name + '.EXE') ExecLine('ZIP.EXE ' + Name + ' ' + Name + '.DOC') 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 var Blanks DocOut Procedure Wr (St) AppendArray(DocOut,Blanks + St) EndProc Procedure GenDoc (Name) var Doc Ord Title Price SavPrice St Writeln '==> Documenting ' Name ' ...' Dispose(DocOut) Blanks = ' ' ExecLine('.\' +Name + '.EXE /? >TMP') ReadTextFile('TMP',Doc) DelFile('TMP') DelFile(Name + '.DOC') ReadTextFile('ORDER.TXT',Ord) Title = Doc[1] if Title = '' then Title = Doc[2] if left(Title,14) = 'Computer Tyme ' delete(Title,1,14) endif loop Doc St = Doc[LoopIndex] if pos('Price',St) > 0 SavPrice On endif if St = '' SavPrice Off endif if SavPrice AppendArray(Price,St) endif endloop Loop Doc Wr(Doc[LoopIndex]) EndLoop Wr('') Wr('==========================================================' + Char(12)) Wr('') Loop Divorce Wr(LoopVal) EndLoop Wr('') Wr('==========================================================' + Char(12)) Blanks = ' ' Loop Ord St = Ord[LoopIndex] if pos('[PatchTitle]',St) > 0 Wr('==> ' + Title) elseif pos('[PatchPrice]',St) > 0 loop Price Wr('==> ' + Price[LoopIndex]) endloop else AppendArray(DocOut,St) endif EndLoop WriteTextFile(Name + '.DOC',DocOut) EndProc