home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / chkinipm.zip / CHECKINI1.CMD next >
OS/2 REXX Batch file  |  2002-05-27  |  7KB  |  199 lines

  1. /*This REXX program provides a PMREXX user interface, GUI, to the checkini.exe program.*/
  2. /*It uses PMREXX to provide a GUI for instructions on running checkini.exe by selecting one or more of */
  3. /*its options. After the user selects one or more options, the program calls another REXX program,*/
  4. /*CHECKINI2.CMD, to run the checkini.exe program in an OS/2 command window with the*/
  5. /*selected options passed on to checkini.exe*/
  6.  
  7.  
  8.  
  9. /*Begin finding the location of this REXX program, the CHECKINI2.CMD REXX program and the checkini.exe executable file*/
  10. PARSE SOURCE OperatingSystem HowCalled FileSpec
  11. ProgramLocation = ""
  12. FileSpecPortion = FileSpec
  13. DO UNTIL FileSpecPortion = ""
  14.     PARSE Var FileSpecPortion FirstPart "\" SecondPart
  15.     SELECT
  16.         WHEN ProgramLocation = "" & SecondPart \= "" THEN ProgramLocation = FirstPart
  17.         WHEN ProgramLocation \= "" & SecondPart \= "" THEN ProgramLocation = ProgramLocation"\"FirstPart
  18.         OTHERWISE NOP
  19.     END    /*Ends "SELECT" Section*/
  20.     FileSpecPortion = SecondPart
  21. END    /*Ends "DO UNTIL FileSpecPortion = """ Section*/
  22. /*End finding the location of this REXX program, the CHECKINI2.CMD REXX program and the checkini.exe executable file*/
  23.  
  24.  
  25.  
  26. /*Begin specifying the desired options for checkini.exe*/
  27. ErrorChance = 5
  28. TABLE:
  29. SAY "This REXX program provides a PMREXX graphical user interface, GUI, to the checkini.exe program"
  30. SAY ""
  31. SAY ""
  32. SAY "The following desired commandline options are available for executing checkini.exe:"
  33. SAY ""
  34. SAY "        OPTION DESCRIPTION                                OPTION PARAMETER"
  35. SAY "    Write the corrections to the ini-files with confirmations for every change.  (****)        /C"
  36. SAY "    Specify a different location for the ini-files that are to be checked.                /Path"
  37. SAY "    Specify a name (the path) for the logfile (the default is CHECKINI.LOG).            /L:LogFileName"
  38. SAY "    Write all the output to the logfile (normally only problems are written).            /W"
  39. SAY "    Write everything (all the output) to the logfile, but only the errors to the screen.        /W:2"
  40. SAY "    Write everything to the logfile, but (almost) nothing to the screen.                /W:3"
  41. SAY "    Run 'silent' and only write to the errors to the logfile (program runs faster).  (****)        /S"
  42. SAY "    Do not report errors on network drives or removable local drives.  (****)            /R"
  43. SAY "    Manually specify the location of the desktop (use only if checkini asks for it).        /D"
  44. SAY "    Auto answer whether or not to correct each problem with a 'YES' (use only with /C).        /Y"
  45. SAY "    Auto answer ...., with a 'YES' and also no confirmation for any individual tests.  (****)    /Y:2"
  46. SAY "    Enable the disk scan function (do not use, if more than 1 OS/2 version installed).        /T"
  47. SAY "   Only check on PM_Workplace:Handles0/1 (NOTE: could cause UNKNOWN OBJECT errors)            /H"
  48. SAY "    The four (4) preferred options, '/C /S /R /Y:2', the ones with the four (4) asterisks        /P"
  49. SAY "    Show information, or help.                                    /?"
  50. SAY ""
  51. SAY ""
  52. SAY "If you want more than 1 option, separate each one with a space. Please select the desired commandline option,"
  53. SAY "or options, as given above. Enter it, or them, on the PMREXX Input line, above. Then press the ENTER key."
  54. PARSE UPPER PULL Options
  55. SAY ""
  56. SAY ""
  57. SELECT
  58.     WHEN ErrorChance = 0 THEN DO
  59.         SAY "You have incorrectly entered the option data 5 times. You will not be able to correct"
  60.         SAY "any more errors. Instead, this program will now terminate. Please try again, this time"
  61.         SAY "correctly entering the desired options."
  62.     END    /*Ends "" Section*/
  63.  
  64.     OTHERWISE DO
  65.         CALL ERRORCHECKING
  66.         NOP
  67.     END    /*Ends "OTHERWISE DO" Section*/
  68. END    /*Ends "SELECT" Section*/
  69.  
  70. IF TestFailure = "YES" THEN SIGNAL TABLE
  71.  
  72.  
  73. /*Begin re-specifying the options in the format that checkini wants and uses*/
  74. Options = ""
  75. SELECT
  76.     WHEN Part.0 = 1 & Part.1 = "/P" THEN
  77.     Options = "/C /S /R /Y:2"
  78.  
  79.     OTHERWISE DO
  80.         DO M = 1 TO Part.0 BY 1
  81.             Options = Options" "Part.M
  82.         END M    /*Ends "DO M = 1 TO Part.0 BY 1" Section*/
  83.     END    /*Ends "OTHERWISE DO" Section*/
  84. END    /*Ends "SELECT" Section*/
  85. /*End re-specifying the options in the format that checkini wants and uses*/
  86. /*End specifying the desired options for checkini.exe*/
  87.  
  88.  
  89.  
  90. /*Begin calling the CHECKINI2.CMD REXX procedure, which in turn will call the checkini.exe program*/
  91. SAY "You must now open the 'CALL "ProgramLocation"\CHECKINI2.CMD ...,' OS/2 command window, using the"
  92. SAY "OS/2 Window List (CNTRL-ESC). Double left mouse click on 'CALL "ProgramLocation"\CHECKINI2.CMD ...,'"
  93. SAY "in the OS/2 Window List and then press the ENTER key in the OS/2 command window session that results."
  94. SAY "Finally, follow the instructions from checkini.exe."
  95. Commandline = "CALL "ProgramLocation"\CHECKINI2.CMD "Options
  96. INTERPRET "Commandline"
  97. /*End calling the CHECKINI2.CMD REXX procedure, which in turn will call the checkini.exe program*/
  98.  
  99.  
  100.  
  101. /*Begin specifying whether or not you wish to open the checkini log file*/
  102. SAY ""
  103. SAY ""
  104. SAY "Please select whether or not you wish to open the checkini log file. Enter a 'Y' (or, a 'y') if you"
  105. SAY "want to open the log file. Otherwise, just press the ENTER key."
  106. SAY ""
  107. SAY ""
  108. PARSE UPPER PULL Response
  109. SELECT
  110.     WHEN Response = "Y" THEN DO
  111.         CALL OPENLOGFILE
  112.         NOP
  113.     END
  114.  
  115.     OTHERWISE NOP
  116. END    /*Ends "SELECT" Section*/
  117. /*End specifying whether or not you wish to open the checkini log file*/
  118. FINISH:
  119. EXIT
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. ERRORCHECKING:
  130. TestFailure = "NO"
  131. LogFileName = ""
  132. Part. = ""
  133. Test. = ""
  134. Remaining = "Harry"
  135. Selections = Options
  136. M = 0
  137. DO UNTIL Remaining = ""
  138.     M = M + 1
  139.     LogFileNameTest = LEFT(Selections,3)
  140.     SELECT
  141.         WHEN LogFileNameTest = "/L:" THEN DO    /*Parse the options, when a log file name is specified*/
  142.             PARSE VAR Selections Part.M Remaining
  143.             Selections = Remaining
  144.             PartLength = LENGTH(Part.M)
  145.             DesiredLength = (PartLength - 3)
  146.             LogFileName = SUBSTR(Part.M,4,DesiredLength)
  147.             Part.M = "/L"LogFileName
  148.         END    /*Ends "WHEN LogFileNameTest = "/L:" THEN DO" Section*/
  149.         
  150.         OTHERWISE DO    /*Parse the options, when a log file is not specified*/
  151.             PARSE VAR Selections Part.M Remaining
  152.             Selections = Remaining
  153.         END    /*Ends "OTHERWISE DO" Section*/
  154.     END    /*Ends "SELECT" Section*/
  155. END    /*Ends "DO UNTIL Remaining = """ Section*/
  156. Part.0 = M
  157. DO M = 1 TO Part.0 BY 1
  158.     Test = LEFT(Part.M,1)
  159.     SELECT
  160.         WHEN Test \= "/" THEN DO
  161.             ErrorChance = (ErrorChance - 1)
  162.             TestFailure = "YES"
  163.             SAY "You did not enter the options correctly. You left out a preceding '/' on one or more of the options."
  164.             SAY "Please re-enter the desired options correctly. If you do not enter the options correctly, you will"
  165.             SAy "have only "ErrorChance "more chances to correct the mistake(s)."
  166.             SAY ""
  167.             SAY ""
  168.             SAY ""
  169.             SAY ""
  170.             LEAVE
  171.         END    /*Ends "WHEN Test \= "/" THEN DO" Section*/
  172.  
  173.         OTHERWISE NOP
  174.     END    /*Ends "SELECT" Section*/
  175. END M    /*Ends "DO M = 1 TO Part.0 BY 1" Section*/
  176. RETURN
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186. OPENLOGFILE:
  187. SAY "You must now open the log file by selecting the OS/2 System Editor, using the OS/2 Window List."
  188. SAY "Press the CONTROL-ESCAPE keys to open the OS/2 Window List. Double mouse click on the 'E.EXE'"
  189. SAY "choice in the window list."
  190. SELECT
  191.     WHEN LogFileName = "" THEN LogFile = "CHECKINI.LOG"
  192.  
  193.     OTHERWISE LogFile = LogFileName
  194. END    /*Ends "SELECT" Section*/
  195. LogFilePath = ProgramLocation"\"LogFile
  196. Commandline = 'E.EXE "'LogFilePath'"'
  197. INTERPRET "Commandline"
  198. RETURN
  199.