Comment ======================================= Level 1 Menu Level 1 Menu requires a data file, in which it stores information about the choices. It has password capabilites to keep the user Out of the modify and exit to dos choices. * Warning * Messing with the *.dat file will mess up your program !!!! (C) CopyRight 1990 Computer Tyme * All rights Reserved (417)866-1222 Programmed by Kevin Moore ======================================= EndComment Var MenuInverseForeColor MenuInverseBackColor MainScreenForeColor Menu NewProgram Subs TotalSubs LongestSubLine MenuHeader MenuTitle ModifyPassWord ExitToDosPassWord ChoicePtr Offset %ThisDirectory LongestItem FileSaved MenuForeColor MenuBackColor MenuBorderForeColor MenuBorderBackColor MenuHeaderForeColor MenuHeaderBackColor ExplodeStatus ShadowStatus SoundStatus Index I In TmpSt BorderStyle BottomOfScreenText MainScreenBackColor TmpWd Height Width ScreenArr ClockForeColor ClockBackColor Var TitleRow MsgRow BatEditor Count DosUtilPassWord %ThisDrive UtilPassWord MenuName UtilForeColor UtilBackColor UtilBorderForeColor UtilBorderBackColor UtilInverseForeColor UtilInverseBackColor UtilHeaderForeColor UtilHeaderBackColor TitleForeColor TitleBackColor TitleBorderForeColor TitleBorderBackColor TitleInverseForeColor TitleInverseBackColor TitleHeaderForeColor TitleHeaderBackColor BackDropCharacter TitleExplodeStatus TitleShadowStatus TitleSoundStatus UtilExplodeStatus UtilShadowStatus UtilSoundStatus UtilBorderStyle TitleBorderStyle ConBlankTime ConLockword ConBlankMessage VerNo MMActive sdf SubListName DirScanProg Const None = 1 Single = 2 Double = 3 Block = 4 Larr = 19 Rarr = 4 Uarr = 5 Darr = 24 Version = 'Version 1.6' ProgramName = 'Level1 Menu ' CopyRightMsg = '(C) CopyRight 1990 Computer Tyme * All rights reserved.' MMenu = 1 Util = 2 Title = 3 Qualifier InUse Description Path Name PassWord Parameters Pause %ThisDrive = left(path,2) MasterEnvironment MenuName = ReadEnv('MENU') if MenuName > '' If ExistFile(MenuName) LoadData else InitilizeData endif else if ExistFile('MENU.DAT') MenuName = Path + '\MENU.DAT' SetEnv('MENU=' + MenuName) LoadData else MenuName = Path + '\MENU.DAT' SetEnv('MENU=' + MenuName) InitilizeData endif endif DirScanProg = ExistOnPath('PIPEDIR.EXE') if DirScanProg = '' DirScanProg = ExistOnPath('WHEREIS.EXE'); if DirScanProg = '' Abort('You will need WHEREIS.EXE from the DOS TOOLBOX to run this program!') endif endif if pos('PIPEDIR',DirScanProg) > 0 then DirScanProg = DirScanProg + '/W' if ExistOnPath('D.EXE') = '' Abort('You will need D.EXE from the DOS TOOLBOX to run this program!') endif SubListName = GetSubListName ShadowColor (grey, black) DrawTop DrawBottom ('F1 - Help * ? - Mini Help') While ChoicePtr = 0 NoChoices EndWhile Draw Main { Menus } ;------ Uses same name as Pick Directory Procedure GetSubListName var SearchSt W ListName ListName = 'C:\PD.PIC' SearchSt = ReadEnv('PD.EXE') if SearchSt <> '' W = pos('/$',SearchSt) if W > 0 SearchSt = Mid(SearchSt,W + 2,255) ListName = NextWord(SearchSt) endif endif Return ListName EndProc Procedure AdvancedOptions Var Select MakeBox('Advanced Options', 0, 10, 29, 8, Util) Writeln(" A - PassWord") Writeln(" B - Parameters") Writeln(" C - Pause after execute") Writeln(" D - Path") Writeln(" E - Program") Write (" F - Create/Edit Bat File") UseArrows On Repeat Select = GetKey If Select = 'A' FileSaved = False Menu[Index].PassWord = ReadTextLine('PassWord', Menu[Index].PassWord, 35, 16) EndIf If Select = 'B' FileSaved = False Menu[Index].Parameters = ReadTextLine('Program Parameters', Menu[Index].Parameters, 60, 16) EndIf If Select = 'C' FileSaved = False if AskYesNo('Pause after execute?', 16) Menu[Index].Pause = True else Menu[Index].Pause = False Endif EndIf if Select = 'D' then Menu[Index].Path = ReadTextLine('Edit Path', Menu[Index].Path, 50, 16) if Select = 'E' then Menu[Index].Name = ReadTextLine('Edit Program', Menu[Index].Name, 50, 16) if Select = 'F' then EditBat Until Select = ESC EraseTopWindow EndProc ;AdvancedOptions ;--- Procedure Backup Var Select BackUpPath MakeBox('Backup Hard Disk', 26, 17, 30, 4, Util) Writeln(' A - Entire Disk') Write (' B - One Directory') Repeat Select = GetKey if Select = 'A' ChDir('\') Execute('BACKUP C: A: /S') endif if Select = 'B' BackupPath = ChooseDirectory Chdir(BackUpPath) Execute('BACKUP C: A:') endif if Select = F1 then Help Until Select = ESC EraseTopWindow EndProc ;BackUp ;--- Procedure Colors (WinNum) Var Select MakeBox('Colors', 36, 11, 17, 6, Util) Writeln(" A - Inside ") Writeln(" B - Border ") Writeln(" C - Header ") Write (" D - Inverse ") Repeat Select = GetKey if Select = 'A' if WinNum = MMenu then ChooseColors (MenuForeColor , MenuBackColor, 1) if WinNum = Util then ChooseColors (UtilForeColor, UtilBackColor, 9) if WinNum = Title then ChooseColors (TitleForeColor, TitleBackColor, 13) endif if Select = 'B' if WinNum = MMenu then ChooseColors (MenuBorderForeColor, MenuBorderBackColor, 2) if WinNum = Util then ChooseColors (UtilBorderForeColor, UtilBorderBackColor, 10) if WinNum = Title then ChooseColors (TitleBorderForeColor, TitleBorderBackColor, 14) endif if Select = 'C' if WinNum = MMenu then ChooseColors (MenuHeaderForeColor, MenuHeaderBackColor, 4) if WinNum = Util then ChooseColors (UtilHeaderForeColor, UtilHeaderBackColor, 12) if WinNum = Title then ChooseColors (TitleHeaderForeColor, TitleHeaderBackColor, 16) endif if Select = 'D' if WinNum = MMenu then ChooseColors (MenuInverseForeColor, MenuInverseBackColor, 3) if WinNum = Util then ChooseColors (UtilInverseForeColor, UtilInverseBackColor, 11) if WinNum = Title then ChooseColors (TitleInverseForeColor, TitleInverseBackColor, 15) endif Until Select = ESC EraseTopWindow EndProc ;ColorsMenu ;--- Procedure DosUtilities Var Select Parm ClearScreenFirst On ClearScreenOnExit On MakeBox('Dos Utilities', 5, 8, 25, 11, Util) Writeln(' A - Format Floppies') Writeln(' B - Directory') Writeln(' C - Free') Writeln(' D - Backup Hard Disk') Writeln(' E - Directory Master') Writeln(' F - Pick Directory') Writeln(' G - Whereis') Writeln(' H - DOS Shell') Write (' I - DOS command') Repeat Select = GetKey if Select = 'A' then Format if Select = 'B' Parm = ReadTextLine('Directory Mask', path + '\*.*', 60, 10) if Parm = '' then Parm = path + '\*.*' if LastKey = Char(13) if ExistOnPath('D.EXE') > '' Execute('D ' + Parm + ' /W') else Execute('DIR ' + Parm + ' | more') endif endif endif if Select = 'C' Parm = ReadTextLine('Drive', left(path,2), 60, 10) if LastKey = char(13) if ExistonPath('FREE.EXE') > '' Execute('FREE ' + Parm + ' | More') else Execute('Chkdsk ' + Parm + ' | More') endif endif endif if Select = 'D' then BackUp if Select = 'E' if ExistOnPath('DM.COM') > '' Execute('DM') else Error('Could not find Directory Master!') endif endif if Select = 'F' if ExistOnPath('PD.EXE') > '' Execute('PD') else Error('Could not find Pick Directory!') endif endif if Select = 'G' if DirScanProg > '' Parm = ReadTextLine(' Mask (*.doc) ', '', 60, 10) if Lastkey = Char(13) then Execute('WHEREIS ' + Parm + ' | more ') else Error('Could not find Whereis!') endif endif if Select = 'H' if ExistOnPath('DOLIST.EXE') > '' Execute('DOLIST') else Execute('COMMAND') endif endif if Select = 'I' Parm = ReadTextLine('DOS Command', '', 60, 10) if LastKey = Char(13) Execute(Parm) endif endif Until Select = ESC EraseTopWindow EndProc ;DosUtilities ;--- Procedure Edit Var x y spc = ' ' Select FileSaved = False if not ExistFile SubListName ScanDirectories else ReadTextFile SubListName Subs endif TotalSubs = NumberOfElements(Subs) LongestSubLine = LongestLine if ExplodeStatus then Explode Off DrawBottom ('ESC - Main Screen * F4 - Utilities') if ExplodeStatus then Explode On RedrawSelections Repeat Select = GetKey if (Select >= 'A') and (Select <= 'Z') ChoicePtr = ChoicePtr + 1 ModifyMenuChoice (Select) If Select < 'N' GotoXY(6, (Ord(Select) - 64)) Write(spc) GotoXY(6, (Ord(Select) - 64)) else GotoXY(41, (Ord(Select) - 77)) Write(spc) GotoXY(41, (Ord(Select) - 77)) endif Write(Right(Menu[(Ord(Select) - 64)].Description, (Length(Menu[(Ord(Select) - 64)].Description) - 5))) endif if Select = F4 if EnterPassWord(UtilPassWord, 19) EditUtilities endif endif Until Select = ESC UpDate EraseTopWindow EraseTopWindow UseArrows On EndProc ;Edit ;--- Procedure Format Var Select MakeBox( 'Format Floppy Disk Menu', 0, 10, 44, 6, Util) Writeln ' 1 - Format 360 5 - Format /S 360' Writeln ' 2 - Format 1.2M 6 - Format /S 1.2M' Writeln ' 3 - Format 720 7 - Format /S 720' Write ' 4 - Format 1.4M 8 - Format /S 1.4M' Repeat Select = GetKey if Select = '1' then Format2('/4') if Select = '2' then Format2('') if Select = '3' then Format2('/N:9/T:80') if Select = '4' then Format2('/N:18/T:80') if Select = '5' then Format2('/4/S') if Select = '6' then Format2('/S') if Select = '7' then Format2('/N:9/T:80/S') if Select = '8' then Format2('/N:18/T:80/S') if Select = F1 then Help Until Select = ESC EraseTopWindow EndProc ;Format ;--- Procedure Main Var Select MMActive = True %ThisDirectory = Path BlankMessage 'Running Level 1 Menu' BlankTime = 0 UseCommand On NoExit SavePosition On FileSaved = True UseArrows Repeat Select = GetKey if (Select >= 'A') and (Select <= 'Z') Index = (Ord(Select) - 64) if Menu[Index].Inuse Trim(Menu[Index].Name) if Menu[Index].Name > '' BuildBat (Index) else Error('You have not selected a program for this menu choice!!') endif endif endif if Select = F10 EraseTopWindow MMActive = False Edit UpdateScreen MMActive = True endif if Select = F3 if EnterPassWord (DosUtilPassWord, 19) MMActive = False DosUtilities MMActive = True EraseTopWindow Draw endif endif if Select = F4 if EnterPassWord (UtilPassWord, 19) MMActive = False EditUtilities UpDateScreen MMActive = True endif endif if Select = (Char(0) + Char(31)) ;SetUp Setup EndIf if Select = ESC then Leave Until Select = alt0 EndProc ;MainMenu ;--- Procedure MenuBorderStyle (WinNum) Var Select FileSaved = False MakeBox( 'Menu Border Style', 0, 0, 30, 5, Util) Writeln(" A - Single Line Border " + Char(196)) Writeln(" B - Double Line Border " + Char(205)) Write (" C - Block Box Border " + Char(219)) Select = GetKey While Select <> ESC if Select = 'A' if WinNum = MMenu then BorderStyle = Single if WinNum = Util then UtilBorderStyle = Single if WinNum = Title then TitleBorderStyle = Single EraseTopWindow Return endif if Select = 'B' if WinNum = MMenu then BorderStyle = Double if WinNum = Util then UtilBorderStyle = Double if WinNum = Title then TitleBorderStyle = Double EraseTopWindow Return endif if Select = 'C' if WinNum = MMenu then BorderStyle = Block if WinNum = Util then UtilBorderStyle = Block if WinNum = Title then TitleBorderStyle = Block EraseTopWindow Return endif if Select = F1 then Help Select = GetKey EndWhile EraseTopWindow EndProc ;MenuBorderStyle ;--- Procedure BackDrop Var Select FileSaved = False MakeBox( '', 37, 10, 15, 7, Util) Writeln(" A - " + Char(176)) Writeln(" B - " + Char(177)) Writeln(" C - " + Char(178)) Writeln(" D - " + Char(185)) Write (" E - Blank") Select = GetKey While Select <> ESC if Select = 'A' BackDropCharacter = 176 EraseTopWindow Return endif if Select = 'B' BackDropCharacter = 177 EraseTopWindow Return endif if Select = 'C' BackDropCharacter = 178 EraseTopWindow Return endif if Select = 'D' BackDropCharacter = 185 EraseTopWindow Return endif if Select = 'E' BackDropCharacter = 32 EraseTopWindow endif if Select = F1 then Help Select = GetKey EndWhile EraseTopWindow EndProc ;MenuBorderStyle ;--- Procedure WhichWindow Var Select, RC = 0 MakeBox( '', 47, 8, 27, 6, Util) Writeln( " A - Main Menu Window" ) Writeln( " B - Title Window" ) Writeln( " C - Utility Window" ) Write ( " D - Global Settings" ) Repeat Select = GetKey if Select = 'A' Then RC = MMenu if Select = 'B' Then RC = Title if Select = 'C' Then RC = Util if Select = 'D' Then RC = 99 Until ((Select = Esc) or (Rc > 0)) EraseTopWindow Return RC EndProc ;WhichWin ;--- Procedure Global Var Select MakeBox( 'Global', 47, 8, 30, 7, Util) Writeln(" A - Menu Title") Writeln(" B - Menu Header") Writeln(" C - Bottom of screen text") Writeln(" D - BackDrop Character") Write (" E - BackDrop Color") Repeat Select = GetKey FileSaved = False if Select = 'A' MenuTitle = ReadTextLine('Menu Title', MenuTitle, 60, 11) if Not (MenuTitle > '') then MenuTitle = 'Your Name Here' Trim(MenuTitle) endif if Select = 'B' then MenuHeader = ReadTextLine('Menu Header', MenuHeader, 30, 11) if Select = 'C' BottomOfScreenText = ReadTextLine('Bottom of screen text', BottomOfScreenText, 60, 11) if Not (BottomOfScreenText > '') Then BottomOfScreenText = CopyrightMsg endif if Select = 'D' then BackDrop if Select = 'E' then ChooseColors (MainScreenForeColor, MainScreenBackColor, 5) Until Select = Esc EraseTopWindow EndProc ;Global ;--- Procedure Setup Var Select CurrWin TmpBool CurrWin = WhichWindow if CurrWin = 99 Global Return EndIf MakeBox( 'Setup', 47, 8, 29, 7, Util) Writeln(" A - Colors") Writeln(" B - Menu Border Style") Writeln(" C - Exploding Windows") Writeln(" D - Shadows") Write (" E - Sound") Repeat Select = GetKey FileSaved = False if Select = 'A' then Colors (CurrWin) if Select = 'B' then MenuBorderStyle (CurrWin) if Select = 'C' TmpBool = AskYesNo('Use exploding windows ?', 0) if CurrWin = MMenu then ExplodeStatus = TmpBool if CurrWin = Util then UtilExplodeStatus = TmpBool if CurrWin = Title then TitleExplodeStatus = TmpBool endif if Select = 'D' TmpBool = AskYesNo('Use window shadowing ?', 0) if CurrWin = MMenu then ShadowStatus = TmpBool if CurrWin = Util then UtilShadowStatus = TmpBool if CurrWin = Title then TitleShadowStatus = TmpBool endif if Select = 'E' TmpBool = AskYesNo('Use sound effects ?', 0) if CurrWin = MMenu then SoundStatus = TmpBool if CurrWin = Util then UtilSoundStatus = TmpBool if CurrWin = Title then TitleSoundStatus = Tmpbool endif Until Select = Esc EraseTopWindow EndProc ;Setup ;--- Procedure EditUtilities Var Select MakeBox( 'Utilities', 6, 8, 36, 11, Util) Writeln(" A - ReScan Subdirectories") Writeln(" B - Password to edit menu") Writeln(" C - Password to exit to DOS") Writeln(" D - Password for DOS Utilities") Writeln(" E - Password for Utilites") Writeln(" F - View current setup") Writeln(" G - Batch File Editor") Writeln(" H - Main Screen Setup") Write (" I - Save Changes") UseArrows On Select = GetKey While Select <> ESC If Select = 'A' then ScanDirectories if Select = 'B' FileSaved = False ModifyPassWord = ReadTextLine('PassWord to edit menu', ModifyPassWord, 29, 10) endif if Select = 'C' FileSaved = False ExitToDosPassWord = ReadTextLine('PassWord to Exit to DOS',ExitToDosPassWord, 31, 10) endif if Select = 'D' FileSaved = False DosUtilPassWord = ReadTextLine('PassWord for Dos Utilities', DosUtilPassWord, 32, 10) endif if Select = 'E' FileSaved = False UtilPassWord = ReadTextLine('Password for Utilities', UtilPassWord, 30, 10) endif if Select = 'F' then ViewCurrentStatus if Select = 'G' then BatEditor = ReadTextLine('Bat file Editor', BatEditor, 23, 10) if Select = 'H' then Setup if Select = 'I' then SaveChanges if Select = F1 then Help Select = GetKey EndWhile EraseTopWindow EndProc ;EditUtilities ;--- { END MENUS } { File I/O } { Save and Load Menu Data } Procedure LoadData FileAssign(In, MenuName) FileOpen(In) VerNo = FileReadln(In) LongestItem = Value(FileReadln(In)) Width = Value(FileReadln(In)) Height = Value(FileReadln(In)) MenuTitle = FileReadln(In) ModifyPassWord = FileReadln(In) ExitToDosPassWord = FileReadln(In) ChoicePtr = Value(FileReadln(In)) MenuHeader = FileReadln(In) BottomOfScreenText = FileReadln(In) BorderStyle = Value(FileReadln(In)) UtilBorderStyle = Value(FileReadln(In)) TitleBorderStyle = Value(FileReadln(In)) MenuForeColor = Value(FileReadln(In)) MenuBackColor = Value(FileReadln(In)) MenuBorderForeColor = Value(FileReadln(In)) MenuBorderBackColor = Value(FileReadln(In)) MenuInverseForeColor = Value(FileReadln(In)) MenuInverseBackColor = Value(FileReadln(In)) MenuHeaderForeColor = Value(FileReadln(In)) MenuHeaderBackColor = Value(FileReadln(In)) MainScreenForeColor = Value(FileReadln(In)) MainScreenBackColor = Value(FileReadln(In)) UtilForeColor = Value(FileReadln(In)) UtilBackColor = Value(FileReadln(In)) UtilHeaderForeColor = Value(FileReadln(In)) UtilHeaderBackColor = Value(FileReadln(In)) UtilBorderForeColor = Value(FileReadln(In)) UtilBorderBackColor = Value(FileReadln(In)) UtilInverseForeColor = Value(FileReadln(In)) UtilInverseBackColor = Value(FileReadln(In)) TitleForeColor = Value(FileReadln(In)) TitleBackColor = Value(FileReadln(In)) TitleHeaderForeColor = Value(FileReadln(In)) TitleHeaderBackColor = Value(FileReadln(In)) TitleBorderForeColor = Value(FileReadln(In)) TitleBorderBackColor = Value(FileReadln(In)) TitleInverseForeColor = Value(FileReadln(In)) TitleInverseBackColor = Value(FileReadln(In)) TitleRow = Value(FileReadln(In)) MsgRow = Value(FileReadln(In)) ExplodeStatus = FileReadln(In) = "TRUE" ShadowStatus = FileReadln(In) = "TRUE" SoundStatus = FileReadln(In) = "TRUE" UtilExplodeStatus = FileReadln(In) = "TRUE" UtilShadowStatus = FileReadln(In) = "TRUE" UtilSoundStatus = FileReadln(In) = "TRUE" TitleExplodeStatus = FileReadln(In) = "TRUE" TitleShadowStatus = FileReadln(In) = "TRUE" TitleSoundStatus = FileReadln(In) = "TRUE" i = 1 While i <= ChoicePtr TmpSt = FileReadln(In) Index = Ord(Mid(TmpSt, 2, 1)) - 64 ScreenArr[i] = TmpSt Menu[Index].Description = TmpSt Menu[Index].InUse = TRUE Menu[Index].Path = FileReadln(In) Menu[Index].name = FileReadln(In) Menu[Index].PassWord = FileReadln(In) Trim(Menu[Index].PassWord) Menu[Index].Parameters = FileReadln(In) Menu[Index].Pause = FileReadln(In) = "TRUE" i = i + 1 EndWhile BatEditor = FileReadln(In) DosUtilPassWord = FileReadln(In) UtilPassWord = FileReadLn(In) BackDropCharacter = Value(FileReadLn(In)) FileClose(In) EndProc ;LoadData ;--- Procedure SaveChanges Var tmparr, i, x, Out FileSaved = TRUE UseArrows Off MessageBox('', 'Saving...', 0, 0) ReadTextFile(MenuName, tmparr) UpDate FileAssign(Out, MenuName) FileCreate(Out) FileWriteln(Out, VerNo) FileWriteln(Out, Str(LongestItem)) FileWriteln(Out, Str(Width)) FileWriteln(Out, Str(Height)) FileWriteln(Out, MenuTitle) FileWriteln(Out, ModifyPassWord) FileWriteln(Out, ExitToDosPassWord) FileWriteln(Out, Str(ChoicePtr)) FileWriteln(Out, MenuHeader) FileWriteln(Out, BottomOfScreenText) FileWriteln(Out, Str(BorderStyle)) FileWriteln(Out, Str(UtilBorderStyle)) FileWriteln(Out, Str(TitleBorderStyle)) FileWriteln(Out, Str(MenuForeColor)) FileWriteln(Out, Str(MenuBackColor)) FileWriteln(Out, Str(MenuBorderForeColor)) FileWriteln(Out, Str(MenuBorderBackColor)) FileWriteln(Out, Str(MenuInverseForeColor)) FileWriteln(Out, Str(MenuInverseBackColor)) FileWriteln(Out, Str(MenuHeaderForeColor)) FileWriteln(Out, Str(MenuHeaderBackColor)) FileWriteln(Out, Str(MainScreenForeColor)) FileWriteln(Out, Str(MainScreenBackColor)) FileWriteln(Out, Str(UtilForeColor)) FileWriteln(Out, Str(UtilBackColor)) FileWriteln(Out, Str(UtilHeaderForeColor)) FileWriteln(Out, Str(UtilHeaderBackColor)) FileWriteln(Out, Str(UtilBorderForeColor)) FileWriteln(Out, Str(UtilBorderBackColor)) FileWriteln(Out, Str(UtilInverseForeColor)) FileWriteln(Out, Str(UtilInverseBackColor)) FileWriteln(Out, Str(TitleForeColor)) FileWriteln(Out, Str(TitleBackColor)) FileWriteln(Out, Str(TitleHeaderForeColor)) FileWriteln(Out, Str(TitleHeaderBackColor)) FileWriteln(Out, Str(TitleBorderForeColor)) FileWriteln(Out, Str(TitleBorderBackColor)) FileWriteln(Out, Str(TitleInverseForeColor)) FileWriteln(Out, Str(TitleInverseBackColor)) FileWriteln(Out, Str(TitleRow)) FileWriteln(Out, Str(MsgRow)) if ExplodeStatus FileWriteln(Out, 'TRUE') else FileWriteln(Out, 'FALSE') endif if ShadowStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif if SoundStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif if UtilExplodeStatus FileWriteln(Out, 'TRUE') else FileWriteln(Out, 'FALSE') endif if UtilShadowStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif if UtilSoundStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif if TitleExplodeStatus FileWriteln(Out, 'TRUE') else FileWriteln(Out, 'FALSE') endif if TitleShadowStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif if TitleSoundStatus FileWriteln(Out, "TRUE") else FileWriteln(Out, "FALSE") endif i = 1 While i <= 27 if Menu[i].Inuse FileWriteln(Out, Menu[I].Description) FileWriteln(Out, Menu[I].Path) FileWriteln(Out, Menu[I].name) FileWriteln(Out, Menu[I].PassWord) FileWriteln(Out, Menu[I].Parameters) if Menu[I].Pause FileWriteln(Out, 'TRUE') else FileWriteln(Out, 'FALSE') endif endif i = i + 1 EndWhile FileWriteln(Out, BatEditor) FileWriteln(Out, DosUtilPassWord) FileWriteln(Out, UtilPassWord) FileWriteln(Out, Str(BackDropCharacter)) FileClose(Out) EraseTopWindow UseArrows On EndProc ;SaveChanges ;--- { END of FILE I/O } { Utilities } Procedure Abort ( ErrMsg ) ClearScreen ClearScreenOnExit Off WriteLn("Error :") Writeln( ErrMsg ) ExitMenu EndProc ;Abort ;--- Procedure AskYesNo (Question, Row) var YesNo MakeBox( '',(34 - (Length(Question) / 2)), Row, Length(Question) + 14, 3) UseArrows Off Write ' ',Question,' (Y/N) ' YesNo = GetKey YesNo = YesNo = 'Y' if YesNo Write 'Yes' else Write 'No' endif Wait 50 EraseTopWindow UseArrows On Return YesNo EndProc ;AskYesNo ;--- Procedure ChooseColors (OrigX, OrigY, VType) Var X Y Ch UseArrows Off MakeBox( 'Pick Color', 13 , 13, 20, 12) Y = 0 While Y < 8 X = 0 While X < 16 if (X = OrigX) and (Y = OrigY) Ch = 254 else Ch = 4 endif WriteColor(Ch, X, Y) X = X + 1 EndWhile Y = Y + 1 EndWhile X = OrigX Y = OrigY repeat ; WriteColor(15,X,Y) GotoXY(X + 2, Y + 2) Ch = GetKey if (X = OrigX) and (Y = OrigY) WriteColor(254,X,Y) else WriteColor(4,X,Y) endif if Ch = Char(Larr) then X = ((X + 15) mod 16) if Ch = Char(Rarr) then X = ((X + 1) mod 16) if Ch = Char(Uarr) then Y = ((Y + 7) mod 8) if Ch = Char(Darr) then Y = ((Y + 1) mod 8) if Ch = Esc X = OrigX Y = OrigY endif until ((Ch = Esc) or (Ch = Char(13))) EraseTopWindow if VType = 1 MenuForeColor = X MenuBackColor = Y endif if VType = 2 MenuBorderForeColor = X MenuBorderBackColor = Y endif if Vtype = 3 MenuInverseForeColor = X MenuInverseBackColor = Y endif if Vtype = 4 MenuHeaderForeColor = X MenuHeaderBackColor = Y endif if Vtype = 5 MainScreenForeColor = X MainScreenBackColor = Y endif if Vtype = 6 ClockForeColor = X ClockBackColor = Y endif if Vtype = 9 UtilForeColor = X UtilBackColor = Y endif if Vtype = 10 UtilBorderForeColor = X UtilBorderBackColor = Y endif if Vtype = 11 UtilInverseForeColor = X UtilInverseBackColor = Y endif if Vtype = 12 UtilHeaderForeColor = X UtilHeaderBackColor = Y endif if Vtype = 13 TitleForeColor = X TitleBackColor = Y endif if Vtype = 14 TitleBorderForeColor = X TitleBorderBackColor = Y endif if Vtype = 15 TitleInverseForeColor = X TitleInverseBackColor = Y endif if Vtype = 16 TitleHeaderForeColor = X TitleHeaderBackColor = Y endif UseArrows On EndProc ;ChooseColors ;--- Procedure ChooseDirectory var BoxDim SubChoice if TotalSubs > 1 BoxDim[3] = Min(LongestSubLine + 6,ScreenWidth - 6) BoxDim[4] = Min(TotalSubs + 2,ScreenHeight - 6) BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1) BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4) MakeBox( '', BoxDim[1], BoxDim[2], BoxDim[3], BoxDim[4]) SubChoice = PickOne Subs EraseTopWindow endif if TotalSubs = 1 then SubChoice = Subs[1] Return SubChoice EndProc ;ChooseDirectory ;--- Procedure ChooseProgram (SubDir) var BoxDim Progs ProgChoice TotalProgs LongestProgLine MessageBox( '', 'Scanning Programs', 35, 18) ClearScreenFirst Off UseCommand On Execute 'D ' + SubDir + '/F/R/O > PROGS.PIC' ReadTextFile 'PROGS.PIC' Progs DelFile 'PROGS.PIC' TotalProgs = NumberOfElements(Progs) LongestProgLine = LongestLine EraseTopWindow if TotalProgs > 0 BoxDim[3] = Min(LongestProgLine + 6,ScreenWidth - 6) BoxDim[4] = Min(TotalProgs + 2,ScreenHeight - 4) BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1) BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4) DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4] ProgChoice = PickOne Progs EraseTopWindow endif Return ProgChoice EndProc ;ChooseProgram ;--- Procedure EditBat Var %Exec ClearScreenOnExit On ClearScreenFirst On {Check to See if user has already specified bat file } if Not (Right(Menu[Index].Name, 3) = "BAT") Menu[Index].Name = UpperCase(ReadTextLine('Enter BAT File Name', Menu[Index].Name, 50, 16)) endif if LastKey <> Esc %Exec = BatEditor + " " + Menu[Index].Name Execute(%Exec) endif EndProc ;EditBat ;--- Procedure EnterPassWord (pass, row) Var LY TX RY BX TmpSt Trim(Pass) if Not (Length(pass) > 0) then Return true Security On if Length(pass) < 20 RY = 21 else RY = Length(pass) + 1 endif TX = 6 LY = 3 BX = 3 MakeBox( 'PassWord', LY, TX, RY, BX, Util) Write ' ' TmpSt = Readln Security Off EraseTopWindow if TmpSt = pass Return True else Return False endif EndProc ;EnterPassWord ;--- Procedure Error (ErrMsg) BoxHeaderColor White Blue BoxBorderColor White Red BoxInsideColor White Red BoxHeader = " Error " DoubleLineBox DrawBox (80 - Length(ErrMsg) /2) 10 (Length(ErrMsg) + 4) 3 WriteCenter (ErrMsg) Write(char(7)) Wait(250) EraseTopWindow SingleLineBox EndProc ;Error ;--- Procedure MainColors Explode ExplodeStatus Sound SoundStatus Shadow ShadowStatus if BorderStyle = None then NoBoxBorder if BorderStyle = Single then SingleLineBox if BorderStyle = Double then DoubleLineBox if BorderStyle = Block then BlockBox InverseColor MenuInverseForeColor MenuInverseBackColor BoxHeaderColor MenuHeaderForeColor MenuHeaderBackColor BoxInsideColor MenuForeColor MenuBackColor BoxBorderColor MenuBorderForeColor MenuBorderBackColor EndProc ;MainColors ;--- Procedure UtilColors Explode UtilExplodeStatus Sound UtilSoundStatus Shadow UtilShadowStatus if UtilBorderStyle = None then NoBoxBorder if UtilBorderStyle = Single then SingleLineBox if UtilBorderStyle = Double then DoubleLineBox if UtilBorderStyle = Block then BlockBox InverseColor UtilInverseForeColor UtilInverseBackColor BoxHeaderColor UtilHeaderForeColor UtilHeaderBackColor BoxInsideColor UtilForeColor UtilBackColor BoxBorderColor UtilBorderForeColor UtilBorderBackColor EndProc ;UtilColors ;--- Procedure TitleColors Explode TitleExplodeStatus Sound TitleSoundStatus Shadow TitleShadowStatus if TitleBorderStyle = None then NoBoxBorder if TitleBorderStyle = Single then SingleLineBox if TitleBorderStyle = Double then DoubleLineBox if TitleBorderStyle = Block then BlockBox InverseColor TitleInverseForeColor TitleInverseBackColor BoxHeaderColor TitleHeaderForeColor TitleHeaderBackColor BoxInsideColor TitleForeColor TitleBackColor BoxBorderColor TitleBorderForeColor TitleBorderBackColor EndProc ;TitleColors ;--- Procedure MakeBox(Header, Col, Row, Wid, Depth, ColorSet) {0 for Col will center box horizontaly} if Col = 0 then Col = (80 - (Wid - 2)) /2 {0 for Row will center box vertically} if Row = 0 then Row = ((25 - Depth) /2) + 1 if Header > '' then BoxHeader = Char(221) + ' ' + Header + ' ' + char(222) if ColorSet = MMenu MainColors else if ColorSet = Util UtilColors else if ColorSet = Title TitleColors endif endif endif DrawBox(Col, Row, Wid, Depth) EndProc ;MakeBox ;--- Procedure MessageBox(Header, Message, Col, Row) MakeBox(Header, Col, Row, (Length(Message) + 4), 3, Util) WriteCenter(Message) EndProc ;MessageBox ;--- Procedure ReadTextLine (Header, Suggestion, MaxAnswerLength, Row) var St Trim(Header) MakeBox( Header, 0, Row, (MaxAnswerLength + 2), 3, Util) Write ' ' InputString = Suggestion St = Readln EraseTopWindow if LastKey <> Char(13) Return Suggestion else Return St endif EndProc ;ReadTextLine ;--- Procedure RedrawSelections Var x y MakeBox( 'Edit', 0, 6, 78, 15, Util) UseArrows On x = 1 y = 1 While x < 14 GotoXY(1, y) if Menu[x].InUse Write(Menu[x].Description) else Write(" " , Char(x + 64) , " - ") endif GotoXY(37,y) if Menu[x + 13].InUse GotoXY(36,y) Write(Menu[x + 13].Description) else Write(Char(x + 77) , " - ") endif x = x + 1 y = y + 1 EndWhile EndProc ;RedrawSelections ;--- Procedure ScanDirectories MessageBox( '', 'Scanning Directories', 0, 0) ClearScreenFirst Off UseCommand On Execute (DirScanProg + '/T >' + SubListName) Dispose Subs ReadTextFile SubListName Subs TotalSubs = NumberOfElements(Subs) LongestSubLine = LongestLine EraseTopWindow EndProc ; ScanDirectories ;--- Procedure Update ChoicePtr = 0 LongestItem = 0 I = 1 While I < 27 if Menu[I].InUse ChoicePtr = ChoicePtr + 1 if Length(Menu[I].Description) > LongestItem LongestItem = Length(Menu[I].Description) endif ScreenArr[ChoicePtr] = Menu[I].Description endif I = I + 1 EndWhile if ChoicePtr < 10 Height = ChoicePtr + 2 Width = LongestItem + 4 else Height = (((ChoicePtr / 2) + (ChoicePtr Mod 2)) + 2) Width = (LongestItem * 2) + 7 endif TitleRow = (((25 - Height) / 2) - 3) MsgRow = ((TitleRow + 5) + Height) EndProc ;Update ;--- Procedure WriteColor (Ch, X, Y) TextColor(X, Y) GotoXY(X + 2, Y + 2) Write(Char(Ch)) EndProc ;WriteColor ;--- Procedure WriteStatus (Msg, Row) GotoXY(1, Row) Write(Msg) GotoXY(67, Row) Write("]") EndProc ;WriteStatus ;--- { ENd of Utilites } { Support Routines } Procedure BuildBat (Num) Var B, I, Ptr, FP if Not FileSaved If AskYesNo("Menu not saved! Save Changes?", 0) then SaveChanges endif if EnterPassWord (Menu[Num].PassWord, 19) if left(Menu[Num].Name,1) = '^' ClearScreenFirst Off ClearScreenOnExit Off B = 'SET MENU=' + Right(Menu[Num].Name, Length(Menu[Num].Name) - 1) Bat(B) Bat('MARX LEVEL2') Exitmenu endif ChDir(Menu[Num].Path) B = Menu[Num].Name + " " + Menu[Num].Parameters Bat(B) if Menu[Num].Pause Then Bat("Pause") B = %ThisDrive Bat(B) B = "CD " + %ThisDirectory Bat(B) ExitMenu EndIf EndProc ;BuildBat ;--- Procedure DrawTop ClockPos 0, 0 TextColor MainScreenForeColor MainScreenBackColor if ColorScreen ClearScreen BackDropCharacter else ClearScreen BackDropCharacter endif TextColor UtilForeColor UtilBackColor MakeBox( '', 1, 1, 80, 4, Title) ClockColor TitleForeColor TitleBackColor ClockPos 3, 2 GotoXY 53, 1 Write(ProgramName, Version) Writeln WriteCenter(MenuTitle) EndProc ;DrawTop ;--- Procedure DrawBottom (s) MakeBox( '', 1, 22, 80, 4, Title) WriteCenter(s) Writeln WriteCenter BottomOfScreenText EndProc ;DrawBottom ;--- Procedure Draw Var I, X MainColors MakeBox( MenuHeader, 0, 0, Width, Height, MMenu) if ChoicePtr < 10 I = 1 While I < ChoicePtr Writeln(' ', ScreenArr[I]) I = I +1 EndWhile Write(' ', ScreenArr[I]) else I = 1 X = LongestItem + 2 While I < (ChoicePtr / 2) Writeln(' ', ScreenArr[I], ' ') I = I + 1 EndWhile Write(' ', ScreenArr[I], ' ') I = I + 1 While I < ChoicePtr GotoXY(X, (I - (ChoicePtr / 2))) Write(' ', ScreenArr[I]) I = I + 1 EndWhile if ChoicePtr Mod 2 = 0 GotoXY(X , (I - (ChoicePtr / 2))) Write(' ',ScreenArr[I]) else GotoXY(X, Height - 2) WriteCenter(ScreenArr[I]) endif endif UseArrows On EndProc ;Draw ;--- Procedure Help Var Key UseArrows Off MakeBox( '* Help *', 5, 8, 70, 12, Util) if ExistFile('Help.html') ViewTextFile('Help.html') else Writeln WriteCenter('HELP.TXT not available!') Writeln Writeln WriteCenter('<*> Press any key to continue <*>') Key = GetKey EraseTopWindow if MMActive EraseTopWindow Draw EndIf endif UseArrows On EndProc ;Help ;--- Procedure InitilizeData VerNo = Version ChoicePtr = 0 Width = 25 Height = 3 ExplodeStatus = False ShadowStatus = False SoundStatus = False TitleExplodeStatus = False TitleShadowStatus = False TitleSoundStatus = False UtilExplodeStatus = False UtilShadowStatus = False UtilSoundStatus = False BorderStyle = Block TitleBorderStyle = Block UtilBorderStyle = Block BottomOfScreenText = CopyRightMsg MenuHeader = '' MenuTitle = 'Your Company Title Here' ModifyPassWord = '' ExitToDosPassWord = '' DosUtilPassWord = '' UtilPassWord = '' BorderStyle = Double MenuForeColor = Cyan MenuBackColor = Blue MenuBorderForeColor = Cyan MenuBorderBackColor = Blue MenuInverseForeColor = Yellow MenuInverseBackColor = Red MenuHeaderForeColor = White MenuHeaderBackColor = Mag MainScreenForeColor = Red MainScreenBackColor = Blue UtilForeColor = Yellow UtilBackColor = Brown UtilBorderForeColor = LRed UtilBorderBackColor = Brown UtilInverseForeColor = Yellow UtilInverseBackColor = Red UtilHeaderForeColor = Yellow UtilHeaderBackColor = Mag TitleForeColor = Yellow TitleBackColor = Brown TitleBorderForeColor = Green TitleBorderBackColor = Brown TitleInverseForeColor = Yellow TitleInverseBackColor = Red TitleHeaderForeColor = White TitleHeaderBackColor = Mag TitleRow = 3 MsgRow = 20 BatEditor = 'me.exe' BackDropCharacter = 178 ConBlankTime = 3 ConLockWord = '' ConBlankMessage = "Running Level 1 Menu" EndProc ;InitilizeData ;--- Procedure Format2 (%Parm) Var Select MakeBox( 'Drive', 55, 14, 11, 4, Util) Writeln ' A:' Write ' B:' Select = GetKey while Select <> ESC if Select = 'A' Execute('FORMAT A: ' + %Parm) EraseTopWindow Return endif if Select = 'B' Execute('Format B: ' + %Parm) EraseTopWindow Return endif Select = GetKey EndWhile EraseTopWindow EndProc ; Format ;--- Procedure Leave if Not FileSaved If AskYesNo("Menu not saved! Save Changes?", 0) SaveChanges endif endif if ExitToDosPassWord > '' if EnterPassWord (ExitToDosPassWord, 19) then ExitMenu else if AskYesNo('Confirm exit to DOS?', 0) then ExitMenu endif EndProc ;Leave ;--- Procedure ModifyMenuChoice (choice) Var Select NewChoice FileSaved = False index = ord(choice) - 64 if Not Menu[index].InUse Menu[index].Description = ' ' Menu[index].Path = ' ' Menu[index].Name = ' ' Menu[index].Password = ' ' Menu[index].Parameters = ' ' Menu[index].Pause = False endif if Index < 14 MakeBox( 'Edit Menu Item', 46, 8, 26, 6, Util) else MakeBox( 'Edit Menu Item', 9, 8, 26, 6, Util) endif Writeln(" A - Screen Text") Writeln(" B - Program") Writeln(" C - Delete choice") Write (" D - Advanced Options") UseArrows On Select = GetKey While Select <> ESC If Select = 'A' FileSaved = False if Not Menu[Index].Inuse NewChoice = True else NewChoice = False endif Menu[Index].Description = ReadTextLine('Screen Text', Right(Menu[Index].Description, (Length(Menu[Index].Description) - 5)), 30, 10) Trim(Menu[Index].Description) If (Length(Menu[Index].Description) > 0) Menu[Index].InUse = True Menu[Index].Description = " " + Char(Index + 64) + " - " + Menu[Index].Description if (Length(Menu[Index].Description) > LongestItem) LongestItem = Length(Menu[Index].Description) endif if NewChoice Menu[Index].Path = ChooseDirectory if Length(Menu[Index].Path) > 0 Menu[Index].Name = ChooseProgram (Menu[Index].Path) endif endif else Menu[Index].InUse = False endif EndIf If Select = 'B' FileSaved = False Menu[Index].Path = ChooseDirectory if Length(Menu[Index].Path) > 0 Menu[Index].Name = ChooseProgram (Menu[Index].Path) endif EndIf If Select = 'C' if AskYesNo('Are you sure?', 0) FileSaved = False Menu[Index].InUse = False Menu[index].Description = ' ' Menu[index].Path = ' ' Menu[index].Name = ' ' Menu[index].Password = ' ' Menu[index].Parameters = ' ' Menu[index].Pause = False EraseTopWindow Return endif EndIf If Select = 'D' then AdvancedOptions Select = GetKey EndWhile EraseTopWindow EndProc ; Modify ;--- Procedure NoChoices Var Select FileSaved = False MakeBox( '', 0, 0, 50, 8, MMenu) WriteCenter('You have no menu choices available!') Writeln Writeln WriteCenter('Press F10 to setup your menu.') Writeln Writeln WriteCenter('Press ESC to exit to DOS.') UseArrows Off Select = ReadKey While (Select <> F10) or (Select <> ESC) if Select = F10 EraseTopWindow Edit Return endif if Select = ESC then Exitmenu Select = ReadKey EndWhile EraseTopWindow EndProc ;NoChoices ;--- Procedure UpdateScreen EraseTopWindow EraseTopWindow EraseTopwindow DrawTop DrawBottom ('F1 - Help * ? - Mini Help') Draw EndProc ;UpdateScreen ;--- Procedure ViewCurrentStatus Var Key UseArrows Off MakeBox('Current Status', 0, 8, 70, 8, Util) WriteStatus(" Password to edit menu...................[" + ModifyPassWord, 1) WriteStatus(" Password to exit to DOS.................[" + ExitToDosPassWord,2) WriteStatus(" Password for DOS utilities..............[" + DosUtilPassWord,3) WriteStatus(" Batch File Editor.................................[" + BatEditor,4) Writeln Writeln WriteCenter("<*> Press any key to continue <*>") Key = GetKey EraseTopWindow UseArrows ON EndProc ;ViewCurrentStatus ;--- Procedure GetKey Var Tmp Repeat Tmp = UpperCase(ReadKey) if Tmp = '?' then KeyHelp if Tmp = F1 Help else if (Tmp = F2) SaveChanges if MMActive EraseTopWindow Draw endif else if Tmp = (Char(0) + '-') if EnterPassWord(ExitToDosPassWord, 6) ExitMenu else if MMActive EraseTopWindow Draw endif endif else Return Tmp endif endif endif Tmp = '' Until Tmp > '' EndProc ;--- Procedure KeyHelp MakeBox(' Mini Help ', 0, 0, 31, 14, Util) Writeln Writeln(' F1 | Help') Writeln(' F2 | Save') Writeln(' F3 | Dos Utilities') Writeln(' F4 | Menu Utilities') Writeln(' F10 | Modify Menu') Writeln(' Alt S | Screen Setup') Writeln(' Alt X | Immediate Exit') Writeln(' ? | This help screen') Writeln Write (' <*> Press any key <*>') WaitOrKbdReady (4500) EraseTopWindow if MMActive EraseTopWindow Draw endif EndProc ;KeyHelp { End of Support Routines }