Comment ========================================================= MarxMenu installation Menu: Copyright 1989-1991 by Marc Perkel * All rights reserved. This is an example of how MarxMenu can be used as a job control language. There is quite an education in MarxMenu tricks here. If you want to write a similar program, this menu is worth studying. ========================================================= EndComment Var VertLine = "³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³" EchoSt FileLine FileLinePtr ProgName NewDos BatExit EchoTail ConfigSysPath ConfigSysLines WorkStr Const PauseTime = 100 DelFile 'MENUS.EXE' if ColorScreen TextColor Cyan Blue ClearScreen 176 GotoXY 1 25 TextColor Yellow Mag ClearLine WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-91 by Marc Perkel' BoxBorderColor White Brown BoxInsideColor Yellow Brown BoxHeaderColor Yellow Mag ClockColor Yellow Brown TextColor Yellow Brown else ClearScreen 176 TextColor Black Grey GotoXY 1 25 ClearLine WriteCenter 'Copyright 1989 by Marc Perkel * All Rights Reserved' BoxBorderColor Black Grey BoxInsideColor Black Grey BoxHeaderColor Black Grey ClockColor Black Grey endif SingleLineBox Explode Off DrawBox 1 1 80 3 GotoXY (54,1) Write "MarxMenu Installation" ClockPos 3 2 BlankTime = 10 ScrollMove Off Explode On Shadow Off BlockBox InverseColor Yellow Red BoxBorderColor Yellow Mag BoxInsideColor Mag Mag DrawBox 10 6 61 17 BoxBorderColor LGreen Blue BoxInsideColor Yellow Blue Shadow On DrawBox 35 13 11 3 WriteCenter 'The' Loop 5 MoveWindow -4 -1 Wait 3 EndLoop DrawBox 35 13 11 3 WriteCenter 'Marx' Loop 5 MoveWindow 4 -1 Wait 3 EndLoop DrawBox 35 13 11 3 WriteCenter 'Menu' Loop 5 MoveWindow -4 1 Wait 3 EndLoop DrawBox 35 13 11 3 WriteCenter 'System' Loop 5 MoveWindow 4 1 Wait 3 EndLoop Wait 20 DrawBox 25 13 31 3 WriteCenter 'Installation Menu' Wait 250 RollWindow 4 EraseTopWindow Wait 20 RollWindow 3 EraseTopWindow Wait 20 RollWindow 2 EraseTopWindow Wait 20 RollWindow 1 EraseTopWindow Wait 20 EraseTopWindow Shadow Off DrawBox 25 11 31 7 NewDos = DosVersionString >= '3.30' ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for ;normal use. SET MXECHO=ON to watch the MARX.BAT run. If ReadEnv('MXECHO') > '' EchoTail = '%MXECHO%' Else EchoTail = 'OFF' EndIf if NewDos EchoSt = '@ECHO ' + EchoTail else EchoSt = 'ECHO ' EchoTail endif ProgName = CleanFileName(Path + '\MARXMENU.EXE') Write ' Creating MARX.BAT ... ' ;----- BatExit is a 0k bat file used to exit batch files FileAssign (BatExit,'BATEXIT.BAT') FileCreate BatExit FileClose BatExit ClearLineBuffer AddLine (EchoSt) AddLine (ProgName + ' %1 ') AddLine ('%MXCMD%') AddLine ('%0 %1') AddLine ('') AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*') AddLine ('') AddLine ('MarxMenu * CopyRight 1989-91 by Marc Perkel') AddLine ('') AddLine ('If you are having trouble getting MarxMenu to work,') AddLine ('the first line of this file can be changed to ECHO ON.') AddLine ('') AddLine ('MarxMenu controls this batch file by writing to the environment') AddLine ('variable MXCMD. %0 = MARX.BAT and restarts this batch file.') AddLine ('') AddLine ('MXSTOP.BAT is executed to exit this batch file.') AddLine ('') AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*') AddLine ('') AddLine (' MARX.BAT') AddLine (' -------- +--MarxMenu Creates--+') AddLine (' +----> @ECHO OFF | |') AddLine (' | MARXMENU.EXE %1 |') AddLine (' | %MXCMD% >--+ +-> $MX00000.BAT') AddLine (' | +--> %0 %1 --+ | ------------') AddLine (' | | | +----------------------> CD\WORDSTAR') AddLine (' +-|------<-----+ WS --+') AddLine (' | |') AddLine (' +-------------------------------------------<-+') AddLine ('') AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT') AddLine ('') AddLine ('By Default, MarxMenu creates the temporary batch file in the same') AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and') AddLine ('the second parameter is a directory, then MarxMenu will create the') AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu') AddLine ('will use it for the temporary file.') AddLine ('') AddLine ('If you set and environment variable TEMP to the name of a directory,') AddLine ("MarxMenu will use this directory for it's temporary batch files.") AddLine ('') AddLine ('Example SET TEMP=C:\TEMPFILE') AddLine ('') AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*') WriteTextFile 'MARX.BAT' FileLine ClearLineBuffer Writeln Write ' Creating DROPTO.BAT ... ' AddLine ('DEL %1') AddLine ('SET KSV=') AddLine ('SET MXCMD=') AddLine ('%2 %3 %4 %5 %6 %7 %8 %9') AddLine ('BATEXIT') AddLine ('') AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*') AddLine ('') AddLine ('DropTo is used when you want to eliminate the temporary batch') AddLine ('file created by MarxMenu. This is useful if you shell to DOS') AddLine ('and then run MarxMenu from the dos shell. It avoids the') AddLine ('"Missing Batch File" error.') AddLine ('') AddLine ('DropTo is run from within the temporary batch file you want') AddLine ('to eliminate.') AddLine ('') AddLine ('Usage: DROPTO %0 ') AddLine ('') AddLine ("Here's how it works:") AddLine ('') AddLine (' $MX00000.BAT <------deletes this file--------+') AddLine (' ------------ |') AddLine (' DROPTO %0 COMMAND.COM ------------> DEL %1 >-+') AddLine (' SET KSV=') AddLine (' SET MXCMD=') AddLine (' %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9') AddLine ('') AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*') WriteTextFile 'DROPTO.BAT' FileLine ClearLineBuffer Writeln Write ' Creating MXSTOP.BAT ... ' AddLine ('SET MXCMD=') AddLine ('SET KSV=') AddLine ('REM From here, you control the menu exit process!') WriteTextFile 'MXSTOP.BAT' FileLine ClearLineBuffer Writeln Write ' Creating GOFILE.BAT ... ' AddLine (EchoSt) AddLine ('MARXMENU GOFILE %1') AddLine ('REM This batch file is used only with the GOFILE menu.') WriteTextFile 'GOFILE.BAT' FileLine ClearLineBuffer Writeln Wait PauseTime EraseTopWindow CheckEnvSize EraseTopWindow BoxBorderColor Yellow Mag BoxInsideColor White Mag DrawBox 18 10 44 7 BoxBorderColor LGreen Blue BoxInsideColor Yellow Blue DrawBox 23 12 34 3 WriteCenter 'MarxMenu Installed!' Wait PauseTime * 2 EraseTopWindow EraseTopWindow BoxBorderColor LCyan Blue BoxInsideColor White Blue DrawBox 15 9 51 11 WriteCenter '* Warning! *' Writeln Writeln Writeln ' One common mistake that users make is that' Writeln ' you run menus by typing MARX and not' Writeln ' MARXMENU . Run your menus using the' Writeln ' MARX.BAT file. Also, besides reading the' Writeln ' manual, please read the MARXREAD.ME file.' Writeln WriteCenter( ' * Press any Key to Continue * ' ) Cursor Off LastKey = ReadKey EraseTopWindow ExitMenu ;--- Menu Exits Here ;===================== Procedures ======================== ;--- Check the environment size Procedure CheckEnvSize var NeededSpace ShellCommand if EnvFree < 150 ConfigSysPath = ExistOnPath( 'CONFIG.SYS' ) NeededSpace = (EnvSize + 160) / 16 * 16 if DosVersionString < '3.20' ShellCommand = Str(NeededSpace / 16) else ShellCommand = Str(NeededSpace) endif if ConfigSysPath = '' BoxBorderColor LCyan Blue BoxInsideColor White Blue DrawBox 15 8 51 13 WriteCenter '* Warning! *' Writeln char(7) Writeln ' You have a total of ' EnvSize ' bytes of environment' Writeln ' space with only ' EnvFree ' bytes free. MarxMenu' Writeln ' requires about 150 bytes of free environment' Writeln ' space. You should modify you CONFIG.SYS file' Writeln ' as follows:' Writeln WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand Writeln Writeln WriteCenter(' * Press any Key to Continue * ') Cursor Off LastKey = ReadKey EraseTopWindow else ReadTextFile(ConfigSysPath,ConfigSysLines) Loop(NumberOfElements(ConfigSysLines)) WorkStr = UpperCase(ConfigSysLines[LoopIndex]) If (NextWord( WorkStr) = 'SHELL') Delete( ConfigSysLines,LoopIndex,1) EndIf EndLoop ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = 'SHELL=COMMAND.COM /P /E:' + ShellCommand WriteTextFile(ConfigSysPath,ConfigSysLines) endIf endIf EndProc Procedure AddLine (L) FileLinePtr = FileLinePtr + 1 FileLine[FileLinePtr] = L EndProc Procedure ClearLineBuffer Dispose(FileLine) FileLinePtr = 0 EndProc