home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / batch / mxmnu233.zip / INST.MNU < prev    next >
Text File  |  1991-09-10  |  10KB  |  380 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 = DosVersion * 100 + MinorDosVersion >= 330
  130.  
  131. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  132. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  133.  
  134. If ReadEnv('MXECHO') > ''
  135.    EchoTail = '%MXECHO%'
  136. Else
  137.    EchoTail = 'OFF'
  138. EndIf
  139.  
  140. if NewDos
  141.    EchoSt = '@ECHO ' + EchoTail
  142. else
  143.    EchoSt = 'ECHO ' + EchoTail
  144. endif
  145.  
  146.  
  147. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  148.  
  149. Write ' Creating MARX.BAT ... '
  150.  
  151. ;----- BatExit is a 0k bat file used to exit batch files
  152.  
  153. FileAssign (BatExit,'BATEXIT.BAT')
  154. FileCreate BatExit
  155. FileClose  BatExit
  156.  
  157. ClearLineBuffer
  158.  
  159. AddLine (EchoSt)
  160. AddLine (ProgName + ' %1 ')
  161. AddLine ('%MXCMD%')
  162. AddLine (CleanFileName(Path + '\MARX.BAT') + ' %1')
  163. AddLine ('')
  164. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  165. AddLine ('')
  166. AddLine ('MarxMenu * CopyRight 1989-91 by Marc Perkel')
  167. AddLine ('')
  168. AddLine ('If you are having trouble getting MarxMenu to work,')
  169. AddLine ('the first line of this file can be changed to ECHO ON.')
  170. AddLine ('')
  171. AddLine ('MarxMenu controls this batch file by writing to the environment')
  172. AddLine ('variable MXCMD.')
  173. AddLine ('')
  174. AddLine ('MXSTOP.BAT is executed to exit this batch file.')
  175. AddLine ('')
  176. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  177. AddLine ('')
  178. AddLine ('         MARX.BAT')
  179. AddLine ('         --------   +--MarxMenu Creates--+')
  180. AddLine ('  +----> @ECHO OFF  |                    |')
  181. AddLine ('  |      MARXMENU.EXE %1                 |')
  182. AddLine ('  |      %MXCMD% >--+                    +-> $MX00000.BAT')
  183. AddLine ('  | +--> MARX %1 +  |                        ------------')
  184. AddLine ('  | |            |  +----------------------> CD\WORDSTAR')
  185. AddLine ('  +-|------<-----+                           WS --+')
  186. AddLine ('    |                                             |')
  187. AddLine ('    +-------------------------------------------<-+')
  188. AddLine ('')
  189. AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT')
  190. AddLine ('')
  191. AddLine ('By Default, MarxMenu creates the temporary batch file in the same')
  192. AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and')
  193. AddLine ('the second parameter is a directory, then MarxMenu will create the')
  194. AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu')
  195. AddLine ('will use it for the temporary file.')
  196. AddLine ('')
  197. AddLine ('If you set and environment variable TEMP to the name of a directory,')
  198. AddLine ("MarxMenu will use this directory for it's temporary batch files.")
  199. AddLine ('')
  200. AddLine ('Example SET TEMP=C:\TEMPFILE')
  201. AddLine ('')
  202. AddLine ('The MARX.BAT file must be path accessable or you will get a')
  203. AddLine ('"Bad Command or FileName" error. MARXMENU.EXE must also be path')
  204. AddLine ('accessable. The directory where MarxMenu creates temporary batch')
  205. AddLine ('files does not need to be path accessable.')
  206. AddLine ('')
  207. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  208. AddLine ('')
  209. AddLine ('This exit point is used if MXSTOP.BAT can not be found. It is')
  210. AddLine ('usually caused by moving the MarxMenu files from one directory')
  211. AddLine ('to another and not copying all the BAT files.')
  212. AddLine ('')
  213. AddLine (':E')
  214. AddLine ('CLS')
  215. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  216. AddLine ('Echo.')
  217. AddLine ('Echo  The file MXSTOP.BAT, DROPTO.BAT, and BATEXIT.BAT should be in')
  218. AddLine ('Echo  the same directory as the MARX.BAT file. Run MARXMENU INST in')
  219. AddLine ('Echo  the directory where you want MARX.BAT to reside.')
  220.  
  221. WriteTextFile 'MARX.BAT' FileLine
  222.  
  223. ClearLineBuffer
  224.  
  225. Writeln
  226. Write ' Creating DROPTO.BAT ... '
  227.  
  228. AddLine ('DEL %1')
  229. AddLine ('SET KSV=')
  230. AddLine ('SET MXCMD=')
  231. AddLine ('%2 %3 %4 %5 %6 %7 %8 %9')
  232. AddLine ('BATEXIT')
  233. AddLine ('')
  234. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  235. AddLine ('')
  236. AddLine ('DropTo is used when you want to eliminate the temporary batch')
  237. AddLine ('file created by MarxMenu. This is useful if you shell to DOS')
  238. AddLine ('and then run MarxMenu from the dos shell. It avoids the')
  239. AddLine ('"Missing Batch File" error.')
  240. AddLine ('')
  241. AddLine ('DropTo is run from within the temporary batch file you want')
  242. AddLine ('to eliminate.')
  243. AddLine ('')
  244. AddLine ('Usage: DROPTO %0 <command line>')
  245. AddLine ('')
  246. AddLine ("Here's how it works:")
  247. AddLine ('')
  248. AddLine ('     $MX00000.BAT <------deletes this file--------+')
  249. AddLine ('     ------------                                 |')
  250. AddLine ('     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+')
  251. AddLine ('                                         SET KSV=')
  252. AddLine ('                                         SET MXCMD=')
  253. AddLine ('              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9')
  254. AddLine ('')
  255. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  256.  
  257. WriteTextFile 'DROPTO.BAT' FileLine
  258.  
  259. ClearLineBuffer
  260.  
  261. Writeln
  262. Write ' Creating MXSTOP.BAT ... '
  263.  
  264. AddLine ('SET MXCMD=')
  265. AddLine ('SET KSV=')
  266. AddLine ('REM From here, you control the menu exit process!')
  267.  
  268. WriteTextFile 'MXSTOP.BAT' FileLine
  269.  
  270. ClearLineBuffer
  271.  
  272. Writeln
  273. Write ' Creating GOFILE.BAT ... '
  274.  
  275. AddLine (EchoSt)
  276. AddLine ('MARXMENU GOFILE %1')
  277. AddLine ('REM This batch file is used only with the GOFILE menu.')
  278.  
  279. WriteTextFile 'GOFILE.BAT' FileLine
  280.  
  281. ClearLineBuffer
  282.  
  283. Writeln
  284. Wait PauseTime
  285. EraseTopWindow
  286.  
  287. CheckEnvSize
  288.  
  289. EraseTopWindow
  290. BoxBorderColor Yellow Mag
  291. BoxInsideColor White Mag
  292. DrawBox 18 10 44 7
  293. BoxBorderColor LGreen Blue
  294. BoxInsideColor Yellow Blue
  295. DrawBox 23 12 34 3
  296. WriteCenter 'MarxMenu Installed!'
  297. Wait PauseTime * 2
  298. EraseTopWindow
  299. EraseTopWindow
  300.  
  301. BoxBorderColor LCyan Blue
  302. BoxInsideColor White Blue
  303. DrawBox 14 9 52 11
  304. WriteCenter '* Warning! *'
  305. Writeln
  306. Writeln
  307. Writeln '  One common mistake that users make is running'
  308. Writeln '  MARXMENU <menu>. You are supposed to run menus'
  309. Writeln '  by typing MARX <menu> which uses the MARX.BAT'
  310. Writeln '  file. Also, besides reading the manual, please'
  311. Writeln '  read the MARXREAD.ME file.'
  312. Writeln
  313. WriteCenter( ' * Press any Key to Continue * ' )
  314. Cursor Off
  315. LastKey = ReadKey
  316. EraseTopWindow
  317.  
  318. ExitMenu
  319.  
  320. ;--- Menu Exits Here
  321.  
  322. ;===================== Procedures ========================
  323.  
  324. ;--- Check the environment size
  325.  
  326. Procedure CheckEnvSize
  327. var NeededSpace ShellCommand
  328.    if EnvFree < 150
  329.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  330.       NeededSpace = (EnvSize + 160) / 16 * 16
  331.       if DosVersionString < '3.20'
  332.          ShellCommand = Str(NeededSpace / 16)
  333.       else
  334.          ShellCommand = Str(NeededSpace)
  335.       endif
  336.       if ConfigSysPath = ''
  337.          BoxBorderColor LCyan Blue
  338.          BoxInsideColor White Blue
  339.          DrawBox 15 8 51 13
  340.          WriteCenter '* Warning! *'
  341.          Writeln char(7)
  342.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  343.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  344.          Writeln '  requires about 150 bytes of free environment'
  345.          Writeln '  space. You should modify you CONFIG.SYS file'
  346.          Writeln '  as follows:'
  347.          Writeln
  348.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  349.          Writeln
  350.          Writeln
  351.          WriteCenter(' * Press any Key to Continue * ')
  352.          Cursor Off
  353.          LastKey = ReadKey
  354.          EraseTopWindow
  355.       else
  356.          ReadTextFile(ConfigSysPath,ConfigSysLines)
  357.          Loop(NumberOfElements(ConfigSysLines))
  358.            WorkStr = UpperCase(ConfigSysLines[LoopIndex])
  359.            If (NextWord( WorkStr) = 'SHELL')
  360.              Delete( ConfigSysLines,LoopIndex,1)
  361.            EndIf
  362.          EndLoop
  363.          ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = 'SHELL=COMMAND.COM /P /E:' + ShellCommand
  364.          WriteTextFile(ConfigSysPath,ConfigSysLines)
  365.       endIf
  366.    endIf
  367. EndProc
  368.  
  369.  
  370. Procedure AddLine (L)
  371.    FileLinePtr = FileLinePtr + 1
  372.    FileLine[FileLinePtr] = L
  373. EndProc
  374.  
  375.  
  376. Procedure ClearLineBuffer
  377.    Dispose(FileLine)
  378.    FileLinePtr = 0
  379. EndProc
  380.