home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / clninipm.zip / CLEANINI1.CMD next >
OS/2 REXX Batch file  |  2002-05-25  |  9KB  |  231 lines

  1. /*This REXX program provides a PMREXX user interface, GUI, to the cleanini.exe program.*/
  2. /*It uses PMREXX to provide a GUI for instructions on running cleanini.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. /*CLEANINI2.CMS, to run the cleanini.exe program in an OS/2 command window with the*/
  5. /*selected options passed on to cleanini.exe*/
  6.  
  7.  
  8.  
  9. /*Begin finding the location of this REXX program, the CLEANINI2.CMD REXX program and the cleanini.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 CLEANINI2.CMD REXX program and the cleanini.exe executable file*/
  23.  
  24.  
  25.  
  26. /*Begin specifying the desired options for cleanini.exe*/
  27. ErrorChance = 5
  28. TABLE:
  29. SAY "This REXX program provides a PMREXX graphical user interface, GUI, to the cleanini.exe program"
  30. SAY ""
  31. SAY ""
  32. SAY "The following desired commandline options are available for executing cleanini.exe:"
  33. SAY ""
  34. SAY "        OPTION DESCRIPTION                                    OPTION PARAMETER"
  35. SAY "    No option given. Scan the OS2.INI file and write the problems to the file, CLEANINI.LOG."        
  36. SAY "    Make a backup of OS2.INI. Then, write the required corrections to OS2.INI.  (*****)            /C"
  37. SAY "    Restart the WorkPlace Shell (WPS) after making corrections to OS2.INI.  (*****)                /R"
  38. SAY "    Use the option parameters specified in the response file (the path = ResponseFileName)            /R:ResponseFileName"
  39. SAY "    Specify a name (the path) for the logfile (the default is CLEANINI.LOG).                /L:LogFileName"
  40. SAY "    Delete all unused WPS folder positions (PM_Workplace:FolderPos).                    /D:FP"
  41. SAY "    Delete all unused PM folder content (PM_Abstract:FldrContent).                        /D:FC"
  42. SAY "    Delete unnecessary PMWP_ASSOC_TYPE, PMWP_ASSOC_FILTER, PMWP_ASSOC_CHECKSUM and PM_Workplace:Startup.    /D:M"
  43. SAY "    Delete all (equivalent to the parameters: '/D:FP /D:FC /D:M).  (*****)                    /D:A"
  44. SAY "    Scan multiple times so that all unnecessary handles can be deleted.  (*****)                /M"
  45. SAY "    Delete handles of all remote files.  (*****)                                /RFD"
  46. SAY "    Ignore handles of all remote files.                                    /RFI"
  47. SAY "    Change the number of columns on the screen to M (in a VIO window only).                    /COLS:M"
  48. SAY "    Change the number of rows on the screen to N (in a VIO window only).                    /ROWS:N"
  49. SAY "    Only show and log those handles that are deleted.  (*****)                        /LOGDEL"
  50. SAY "    Do not display a logo.                                            /NOLOGO"
  51. SAY "    Force a backup if the '/C' option is not specified.                            /BACKUP"
  52. SAY "    Restore the OS2.INI from the most recent backup.                            /RESTORE"
  53. SAY "    The six (6) preferred options, '/C /R /D:A /M /RFD /LOGDEL', the ones with the five (6) asterisks    /P"
  54. SAY "    Show information, or help.                                        /?"
  55. SAY ""
  56. SAY ""
  57. SAY "If you want more than 1 option, separate each one with a space. Please select the desired commandline option,"
  58. SAY "or options, as given above. Enter it, or them, on the PMREXX Input line, above. Then press the ENTER key."
  59. PARSE UPPER PULL Options
  60. SAY ""
  61. SAY ""
  62. SELECT
  63.     WHEN ErrorChance = 0 THEN DO
  64.         SAY "You have incorrectly entered the option data 5 times. You will not be able to correct"
  65.         SAY "any more errors. Instead, this program will now terminate. Please try again, this time"
  66.         SAY "correctly entering the desired options."
  67.     END    /*Ends "" Section*/
  68.  
  69.     OTHERWISE DO
  70.         CALL ERRORCHECKING
  71.         NOP
  72.     END    /*Ends "OTHERWISE DO" Section*/
  73. END    /*Ends "SELECT" Section*/
  74.  
  75. IF TestFailure = "YES" THEN SIGNAL TABLE
  76.  
  77.  
  78.  
  79. /*Begin re-specifying the options, using the same parameters that cleanini wants and uses*/
  80. SELECT
  81.     WHEN Part.0 = 1 & Part.1 = "/P" THEN
  82.     Options = "/C /RESTART /DELALL /MULTIPASS /REMOTE:DELETE /LOGDEL"
  83.  
  84.     OTHERWISE DO
  85.         DO M = 1 TO Part.0 BY 1
  86.             SELECT
  87.                 WHEN Part.M = "/C" THEN Part.M = "/C"
  88.                 WHEN Part.M = "/R" THEN Part.M = "/RESTART"
  89.                 WHEN Part.M = "/D:FP" THEN Part.M = "/DELFLDPOS"
  90.                 WHEN Part.M = "/D:FC" THEN Part.M = "/DELFLDCONT"
  91.                 WHEN Part.M = "/D:M" THEN Part.M = "/DELMISC"
  92.                 WHEN Part.M = "/D:A" THEN Part.M = "/DELALL"
  93.                 WHEN Part.M = "/M" THEN Part.M = "/MULTIPASS"
  94.                 WHEN Part.M = "/RFD" THEN Part.M = "/REMOTE:DELETE"
  95.                 WHEN Part.M = "/RFI" THEN Part.M = "/REMOTE:IGNORE"
  96.                 WHEN Part.M = "/LOGDEL" THEN Part.M = "/LOGDEL"
  97.                 WHEN Part.M = "/NOLOGO" THEN Part.M = "/NOLOGO"
  98.                 WHEN Part.M = "/BACKUP" THEN Part.M = "/BACK"
  99.                 WHEN Part.M = "/RESTORE" THEN Part.M = "/REST"
  100.                 WHEN Part.M = "/?" THEN Part.M = "/?"
  101.                 OTHERWISE NOP
  102.             END    /*Ends "SELECT" Section*/
  103.         END M    /*Ends "DO M = 1 TO Part.0 BY 1" Section*/
  104.  
  105.  
  106.         Options = ""
  107.         DO M = 1 TO Part.0 BY 1
  108.             Options = Options" "Part.M
  109.         END M    /*Ends "DO M = 1 TO Part.0 BY 1" Section*/
  110.     END    /*Ends "OTHERWISE DO" Section*/
  111. END    /*Ends "SELECT" Section*/
  112. /*End re-specifying the options, using the same parameters that cleanini wants and uses*/
  113. /*End specifying the desired options for cleanini.exe*/
  114.  
  115.  
  116.  
  117. /*Begin calling the CLEANINI2.CMD REXX procedure, which in turn will call the cleanini.exe program*/
  118. Commandline = "CALL "ProgramLocation"\CLEANINI2.CMD "Options
  119. INTERPRET "Commandline"
  120. /*End calling the CLEANINI2.CMD REXX procedure, which in turn will call the cleanini.exe program*/
  121.  
  122.  
  123.  
  124. /*Begin specifying whether or not you wish to open the cleanini log file*/
  125. SAY ""
  126. SAY ""
  127. SAY "Please select whether or not you wish to open the cleanini log file. Enter a 'Y' (or, a 'y') if you"
  128. SAY "want to open the log file. Otherwise, just press the ENTER key."
  129. SAY ""
  130. SAY ""
  131. PARSE UPPER PULL Response
  132. SELECT
  133.     WHEN Response = "Y" THEN DO
  134.         CALL OPENLOGFILE
  135.         NOP
  136.     END
  137.  
  138.     OTHERWISE NOP
  139. END    /*Ends "SELECT" Section*/
  140. /*End specifying whether or not you wish to open the cleanini log file*/
  141. FINISH:
  142. EXIT
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. ERRORCHECKING:
  153. TestFailure = "NO"
  154. LogFileName = ""
  155. Part. = ""
  156. Test. = ""
  157. Remaining = "Harry"
  158. Selections = Options
  159. M = 0
  160. DO UNTIL Remaining = ""
  161.     M = M + 1
  162.     FileNameTest1 = LEFT(Selections,3)
  163.     SELECT
  164.         WHEN FileNameTest = "/L:" THEN DO    /*Parse the options, when a log file name is specified*/
  165.             PARSE VAR Selections Part.M Remaining
  166.             Selections = Remaining
  167.             PartLength = LENGTH(Part.M)
  168.             DesiredLength = (PartLength - 3)
  169.             LogFileName = SUBSTR(Part.M,4,DesiredLength)
  170.             Part.M = "/LOG:"LogFileName
  171.         END    /*Ends "WHEN LogFileNameTest = "/L" THEN DO" Section*/
  172.  
  173.         WHEN FileNameTest = "/R:" THEN DO    /*Parse the options, when a response file name is specified*/
  174.             PARSE VAR Selections Part.M Remaining
  175.             Selections = Remaining
  176.             PartLength = LENGTH(Part.M)
  177.             DesiredLength = (PartLength - 3)
  178.             ResponseFileName = SUBSTR(Part.M,4,DesiredLength)
  179.             Part.M = "/RESP:"ResponseFileName
  180.         END    /*Ends "WHEN LogFileNameTest = "/L" THEN DO" Section*/
  181.  
  182.         OTHERWISE DO    /*Parse the options, when a log file is not specified*/
  183.             PARSE VAR Selections Part.M Remaining
  184.             Selections = Remaining
  185.         END    /*Ends "OTHERWISE DO" Section*/
  186.     END    /*Ends "SELECT" Section*/
  187. END    /*Ends "DO UNTIL Remaining = """ Section*/
  188. Part.0 = M
  189. DO M = 1 TO Part.0 BY 1
  190.     Test = LEFT(Part.M,1)
  191.     SELECT
  192.         WHEN Test \= "/" THEN DO
  193.             ErrorChance = (ErrorChance - 1)
  194.             TestFailure = "YES"
  195.             SAY "You did not enter the options correctly. You left out a preceding '/' on one or more of the options."
  196.             SAY "Please re-enter the desired options correctly. If you do not enter the options correctly, you will"
  197.             SAy "have only "ErrorChance "more chances to correct the mistake(s)."
  198.             SAY ""
  199.             SAY ""
  200.             SAY ""
  201.             SAY ""
  202.             LEAVE
  203.         END    /*Ends "WHEN Test \= "/" THEN DO" Section*/
  204.  
  205.         OTHERWISE NOP
  206.     END    /*Ends "SELECT" Section*/
  207. END M    /*Ends "DO M = 1 TO Part.0 BY 1" Section*/
  208. RETURN
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218. OPENLOGFILE:
  219. SAY "You must now open the log file by selecting the OS/2 System Editor, using the OS/2 Window List."
  220. SAY "Press the CONTROL-ESCAPE keys to open the OS/2 Window List. Double mouse click on the 'E.EXE'"
  221. SAY "choice in the window list."
  222. SELECT
  223.     WHEN LogFileName = "" THEN LogFile = "CLEANINI.LOG"
  224.  
  225.     OTHERWISE LogFile = LogFileName
  226. END    /*Ends "SELECT" Section*/
  227. LogFilePath = ProgramLocation"\"LogFile
  228. Commandline = 'E.EXE "'LogFilePath'"'
  229. INTERPRET "Commandline"
  230. RETURN
  231.