home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / INST.MNU < prev    next >
Text File  |  1991-03-26  |  10KB  |  365 lines

  1. Comment
  2. =========================================================
  3.  
  4. MarxMenu installation Menu:
  5.  
  6. Copyright 1989-1991 by Marc Perkel * All rights reserved.
  7.  
  8. This is an example of how MarxMenu can be used as a job control
  9. language. There is quite an education in MarxMenu tricks here. If
  10. you want to write a similar program, this menu is worth studying.
  11.  
  12. =========================================================
  13. EndComment
  14.  
  15. Var
  16.   VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
  17.   EchoSt
  18.   FileLine
  19.   FileLinePtr
  20.   ProgName
  21.   NewDos
  22.   BatExit
  23.   EchoTail
  24.   ConfigSysPath
  25.   ConfigSysLines
  26.   WorkStr
  27.  
  28. Const
  29.   PauseTime = 100
  30.  
  31. DelFile 'MENUS.EXE'
  32.  
  33.  
  34. if ColorScreen
  35.    TextColor Cyan Blue
  36.    ClearScreen 176
  37.    GotoXY 1 25
  38.    TextColor Yellow Mag
  39.    ClearLine
  40.    WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-91 by Marc Perkel'
  41.    BoxBorderColor White Brown
  42.    BoxInsideColor Yellow Brown
  43.    BoxHeaderColor Yellow Mag
  44.    ClockColor Yellow Brown
  45.    TextColor Yellow Brown
  46. else
  47.    ClearScreen 176
  48.    TextColor Black Grey
  49.    GotoXY 1 25
  50.    ClearLine
  51.    WriteCenter 'Copyright 1989 by Marc Perkel * All Rights Reserved'
  52.    BoxBorderColor Black Grey
  53.    BoxInsideColor Black Grey
  54.    BoxHeaderColor Black Grey
  55.    ClockColor Black Grey
  56. endif
  57.  
  58. SingleLineBox
  59. Explode Off
  60. DrawBox 1 1 80 3
  61. GotoXY (54,1)
  62. Write "MarxMenu Installation"
  63. ClockPos 3 2
  64.  
  65. BlankTime = 10
  66. ScrollMove Off
  67.  
  68. Explode On
  69. Shadow Off
  70. BlockBox
  71. InverseColor Yellow Red
  72.  
  73. BoxBorderColor Yellow Mag
  74. BoxInsideColor Mag Mag
  75. DrawBox 10 6 61 17
  76. BoxBorderColor LGreen Blue
  77. BoxInsideColor Yellow Blue
  78. Shadow On
  79.  
  80. DrawBox 35 13 11 3
  81. WriteCenter 'The'
  82. Loop 5
  83.    MoveWindow -4 -1
  84.    Wait 3
  85. EndLoop
  86.  
  87. DrawBox 35 13 11 3
  88. WriteCenter 'Marx'
  89. Loop 5
  90.    MoveWindow 4 -1
  91.    Wait 3
  92. EndLoop
  93.  
  94. DrawBox 35 13 11 3
  95. WriteCenter 'Menu'
  96. Loop 5
  97.    MoveWindow -4 1
  98.    Wait 3
  99. EndLoop
  100.  
  101. DrawBox 35 13 11 3
  102. WriteCenter 'System'
  103. Loop 5
  104.    MoveWindow 4 1
  105.    Wait 3
  106. EndLoop
  107.  
  108. Wait 20
  109. DrawBox 25 13 31 3
  110. WriteCenter 'Installation Menu'
  111. Wait 250
  112. RollWindow 4
  113. EraseTopWindow
  114. Wait 20
  115. RollWindow 3
  116. EraseTopWindow
  117. Wait 20
  118. RollWindow 2
  119. EraseTopWindow
  120. Wait 20
  121. RollWindow 1
  122. EraseTopWindow
  123. Wait 20
  124. EraseTopWindow
  125.  
  126. Shadow Off
  127. DrawBox 25 11 31 7
  128.  
  129. NewDos = DosVersionString >= '3.30'
  130.  
  131.  
  132.  
  133. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  134. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  135.  
  136. If ReadEnv('MXECHO') > ''
  137.   EchoTail = '%MXECHO%'
  138. Else
  139.   EchoTail = 'OFF'
  140. EndIf
  141.  
  142. if NewDos
  143.    EchoSt = '@ECHO ' + EchoTail
  144. else
  145.    EchoSt = 'ECHO ' EchoTail
  146. endif
  147.  
  148.  
  149. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  150.  
  151. Write ' Creating MARX.BAT ... '
  152.  
  153. ;----- BatExit is a 0k bat file used to exit batch files
  154.  
  155. FileAssign (BatExit,'BATEXIT.BAT')
  156. FileCreate BatExit
  157. FileClose  BatExit
  158.  
  159. ClearLineBuffer
  160.  
  161. AddLine (EchoSt)
  162. AddLine (ProgName + ' %1 ')
  163. AddLine ('%MXCMD%')
  164. AddLine ('%0 %1')
  165. AddLine ('')
  166. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  167. AddLine ('')
  168. AddLine ('MarxMenu * CopyRight 1989-91 by Marc Perkel')
  169. AddLine ('')
  170. AddLine ('If you are having trouble getting MarxMenu to work,')
  171. AddLine ('the first line of this file can be changed to ECHO ON.')
  172. AddLine ('')
  173. AddLine ('MarxMenu controls this batch file by writing to the environment')
  174. AddLine ('variable MXCMD. %0 = MARX.BAT and restarts this batch file.')
  175. AddLine ('')
  176. AddLine ('MXSTOP.BAT is executed to exit this batch file.')
  177. AddLine ('')
  178. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  179. AddLine ('')
  180. AddLine ('         MARX.BAT')
  181. AddLine ('         --------   +--MarxMenu Creates--+')
  182. AddLine ('  +----> @ECHO OFF  |                    |')
  183. AddLine ('  |      MARXMENU.EXE %1                 |')
  184. AddLine ('  |      %MXCMD% >--+                    +-> $MX00000.BAT')
  185. AddLine ('  | +--> %0 %1 --+  |                        ------------')
  186. AddLine ('  | |            |  +----------------------> CD\WORDSTAR')
  187. AddLine ('  +-|------<-----+                           WS --+')
  188. AddLine ('    |                                             |')
  189. AddLine ('    +-------------------------------------------<-+')
  190. AddLine ('')
  191. AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT')
  192. AddLine ('')
  193. AddLine ('By Default, MarxMenu creates the temporary batch file in the same')
  194. AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and')
  195. AddLine ('the second parameter is a directory, then MarxMenu will create the')
  196. AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu')
  197. AddLine ('will use it for the temporary file.')
  198. AddLine ('')
  199. AddLine ('If you set and environment variable TEMP to the name of a directory,')
  200. AddLine ("MarxMenu will use this directory for it's temporary batch files.")
  201. AddLine ('')
  202. AddLine ('Example SET TEMP=C:\TEMPFILE')
  203. AddLine ('')
  204. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  205.  
  206. WriteTextFile 'MARX.BAT' FileLine
  207.  
  208. ClearLineBuffer
  209.  
  210. Writeln
  211. Write ' Creating DROPTO.BAT ... '
  212.  
  213. AddLine ('DEL %1')
  214. AddLine ('SET KSV=')
  215. AddLine ('SET MXCMD=')
  216. AddLine ('%2 %3 %4 %5 %6 %7 %8 %9')
  217. AddLine ('BATEXIT')
  218. AddLine ('')
  219. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  220. AddLine ('')
  221. AddLine ('DropTo is used when you want to eliminate the temporary batch')
  222. AddLine ('file created by MarxMenu. This is useful if you shell to DOS')
  223. AddLine ('and then run MarxMenu from the dos shell. It avoids the')
  224. AddLine ('"Missing Batch File" error.')
  225. AddLine ('')
  226. AddLine ('DropTo is run from within the temporary batch file you want')
  227. AddLine ('to eliminate.')
  228. AddLine ('')
  229. AddLine ('Usage: DROPTO %0 <command line>')
  230. AddLine ('')
  231. AddLine ("Here's how it works:")
  232. AddLine ('')
  233. AddLine ('     $MX00000.BAT <------deletes this file--------+')
  234. AddLine ('     ------------                                 |')
  235. AddLine ('     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+')
  236. AddLine ('                                         SET KSV=')
  237. AddLine ('                                         SET MXCMD=')
  238. AddLine ('              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9')
  239. AddLine ('')
  240. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  241.  
  242. WriteTextFile 'DROPTO.BAT' FileLine
  243.  
  244. ClearLineBuffer
  245.  
  246. Writeln
  247. Write ' Creating MXSTOP.BAT ... '
  248.  
  249. AddLine ('SET MXCMD=')
  250. AddLine ('SET KSV=')
  251. AddLine ('REM From here, you control the menu exit process!')
  252.  
  253. WriteTextFile 'MXSTOP.BAT' FileLine
  254.  
  255. ClearLineBuffer
  256.  
  257. Writeln
  258. Write ' Creating GOFILE.BAT ... '
  259.  
  260. AddLine (EchoSt)
  261. AddLine ('MARXMENU GOFILE %1')
  262. AddLine ('REM This batch file is used only with the GOFILE menu.')
  263.  
  264. WriteTextFile 'GOFILE.BAT' FileLine
  265.  
  266. ClearLineBuffer
  267.  
  268. Writeln
  269. Wait PauseTime
  270. EraseTopWindow
  271.  
  272. CheckEnvSize
  273.  
  274. EraseTopWindow
  275. BoxBorderColor Yellow Mag
  276. BoxInsideColor White Mag
  277. DrawBox 18 10 44 7
  278. BoxBorderColor LGreen Blue
  279. BoxInsideColor Yellow Blue
  280. DrawBox 23 12 34 3
  281. WriteCenter 'MarxMenu Installed!'
  282. Wait PauseTime * 2
  283. EraseTopWindow
  284. EraseTopWindow
  285.  
  286. BoxBorderColor LCyan Blue
  287. BoxInsideColor White Blue
  288. DrawBox 15 9 51 11
  289. WriteCenter '* Warning! *'
  290. Writeln
  291. Writeln
  292. Writeln '  One common mistake that users make is that'
  293. Writeln '  you run menus by typing MARX <menu> and not'
  294. Writeln '  MARXMENU <menu>. Run your menus using the'
  295. Writeln '  MARX.BAT file. Also, besides reading the'
  296. Writeln '  manual, please read the MARXREAD.ME file.'
  297. Writeln
  298. WriteCenter( ' * Press any Key to Continue * ' )
  299. Cursor Off
  300. LastKey = ReadKey
  301. EraseTopWindow
  302.  
  303. ExitMenu
  304.  
  305. ;--- Menu Exits Here
  306.  
  307. ;===================== Procedures ========================
  308.  
  309. ;--- Check the environment size
  310.  
  311. Procedure CheckEnvSize
  312. var NeededSpace ShellCommand
  313.    if EnvFree < 150
  314.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  315.       NeededSpace = (EnvSize + 160) / 16 * 16
  316.       if DosVersionString < '3.20'
  317.          ShellCommand = Str(NeededSpace / 16)
  318.       else
  319.          ShellCommand = Str(NeededSpace)
  320.       endif
  321.       if ConfigSysPath = ''
  322.          BoxBorderColor LCyan Blue
  323.          BoxInsideColor White Blue
  324.          DrawBox 15 8 51 13
  325.          WriteCenter '* Warning! *'
  326.          Writeln char(7)
  327.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  328.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  329.          Writeln '  requires about 150 bytes of free environment'
  330.          Writeln '  space. You should modify you CONFIG.SYS file'
  331.          Writeln '  as follows:'
  332.          Writeln
  333.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  334.          Writeln
  335.          Writeln
  336.          WriteCenter(' * Press any Key to Continue * ')
  337.          Cursor Off
  338.          LastKey = ReadKey
  339.          EraseTopWindow
  340.       else
  341.          ReadTextFile(ConfigSysPath,ConfigSysLines)
  342.          Loop(NumberOfElements(ConfigSysLines))
  343.            WorkStr = UpperCase(ConfigSysLines[LoopIndex])
  344.            If (NextWord( WorkStr) = 'SHELL')
  345.              Delete( ConfigSysLines,LoopIndex,1)
  346.            EndIf
  347.          EndLoop
  348.          ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = 'SHELL=COMMAND.COM /P /E:' + ShellCommand
  349.          WriteTextFile(ConfigSysPath,ConfigSysLines)
  350.       endIf
  351.    endIf
  352. EndProc
  353.  
  354.  
  355. Procedure AddLine (L)
  356.    FileLinePtr = FileLinePtr + 1
  357.    FileLine[FileLinePtr] = L
  358. EndProc
  359.  
  360.  
  361. Procedure ClearLineBuffer
  362.    Dispose(FileLine)
  363.    FileLinePtr = 0
  364. EndProc
  365.