home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 30 fixes_v / 30-fixes_v.zip / per310a.zip / ba2desk.cmd < prev    next >
OS/2 REXX Batch file  |  1995-10-23  |  6KB  |  155 lines

  1. /*---------------------------------------------------------------------*/
  2. /*  BA2DESK.CMD - Written by Box Turtle Software                       */
  3. /*  Copyright (C) 1995 by Computer Data Strategies, Inc.               */
  4. /*  Copyright (C) 1994, 1995 by Box Turtle Software                    */
  5. /*  All Rights Reserved                                                */
  6. /*                                                                     */
  7. /*  Recreates the BA/2 desktop objects.                                */
  8. /*                                                                     */
  9. /*  Date        Programmer  Change                                     */
  10. /*  ---------   ----------  ------                                     */
  11. /*  05-08-94    BCB         Initial version                            */
  12. /*  09-10-94    BCB         Confirm path with user before proceeding   */
  13. /*  11-20-94    BCB         Set object ID for backup set shadows       */
  14. /*  03-05-95    BCB         Update for Pro v3.0                        */
  15. /*  09-18-95    BCB         Corrections for .INI entry strangeness     */
  16. /*                                                                     */
  17. /*---------------------------------------------------------------------*/
  18.  
  19. /* Load all REXX system extensions */
  20. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. call SysLoadFuncs
  22.  
  23. /* Say hello to the user */
  24. echo off
  25. say ' '
  26. say 'BA2DESK.CMD - Rebuilds Back Again/2 Personal Edition desktop objects'
  27. say ' '
  28.  
  29. /* Look up installation drive/path */
  30. res = SysIni('USER', 'BackAgain_V3', 'InstPath')
  31. if(res = 'ERROR:') then
  32.   do
  33.     BA2Path = ''
  34.     AskForPath = 'Y'
  35.   end
  36. else
  37.   do
  38.     /* If the last char is a '\', get rid of it */
  39.     if(substr(res, LENGTH(res), 1) = '\') then
  40.       BA2Path = substr(res, 1, LENGTH(res)-1)
  41.     else
  42.       BA2Path = res
  43.     AskForPath = 'N'
  44.   end
  45.  
  46. /* Show this to the user if found */
  47. if(LENGTH(BA2Path) > 0) then
  48.   do
  49.     say 'Current Back Again/2 Personal Edition path is '||BA2Path
  50.     say 'Do you want to change it (Y/N)?'
  51.     AskForPath = translate(SysGetKey("NOECHO"))
  52.   end
  53.  
  54. /* If path not found, prompt for it */
  55. if(AskForPath = 'Y') then
  56.   do
  57.     say 'Please enter the location of Back Again/2 Personal (default = C:\BA2)'
  58.     pull BA2Path
  59.     if(LENGTH(BA2Path) = 0) then
  60.       BA2Path = 'C:\BA2'
  61.   end
  62.  
  63. /* Strip trailing white spaces, etc */
  64. NewPath=''
  65. do iPos = 1 to length(BA2Path)
  66.   /* If this is a non-whitespace char, add it to new path */
  67.   if (substr(BA2Path,iPos,1) > ' ') then
  68.     NewPath = NewPath||substr(BA2Path,iPos,1)
  69. end
  70. BA2Path = NewPath
  71. drop NewPath
  72.  
  73. /* Do we need to alter the INI path? */
  74. if(AskForPath = 'Y') then
  75.   do
  76.     /* Yes, update the .INI value */
  77.     SysIni('USER', 'BackAgain_V3', 'InstPath', BA2Path)
  78.   end
  79.  
  80. /* Create the main folder */
  81. say "Creating main folder..."
  82. res = SysCreateObject("WPFolder", "Back Again/2^Personal Edition", "<WP_DESKTOP>", "OBJECTID=<BA2Folder_V3>", "REPLACE")
  83. if(res = 0) then
  84.    say "Couldn't create main folder"
  85.  
  86. /* Create the backup sets folder */
  87. say "Creating backup sets folder..."
  88. res = SysCreateObject("WPFolder", "Backup Sets", "<BA2Folder_V3>", "OBJECTID=<BA2Sets_V3>", "REPLACE")
  89. if(res = 0) then
  90.   say "Couldn't create backup sets folder"
  91.  
  92. /* Create the backup program object */
  93. say "Creating program object..."
  94. ObjectSetupStr = "EXENAME="||BA2Path||"\BACKUP.EXE;"
  95. ObjectSetupStr = ObjectSetupStr||"OBJECTID=<BA2Exec_V3>;"
  96. ObjectSetupStr = ObjectSetupStr||"STARTUPDIR="||BA2Path||";"
  97. ObjectSetupStr = ObjectSetupStr||"ASSOCFILTER=*.SET;PROGTYPE=PM"
  98. res = SysCreateObject("WPProgram", "Back Again/2^Personal Edition", "<BA2Folder_V3>", ObjectSetupStr, "REPLACE")
  99. if(res = 0) then
  100.   say "Couldn't create program reference object"
  101.  
  102. /* Create the MAKESR program object */
  103. say "Creating program object..."
  104. ObjectSetupStr = "EXENAME="BA2Path"\MAKESR.EXE;"
  105. ObjectSetupStr = ObjectSetupStr||"STARTUPDIR="||BA2Path||";"
  106. ObjectSetupStr = ObjectSetupStr||"PROGTYPE=PM"
  107. res = SysCreateObject("WPProgram", "Update OS/2 Warp^Utility Diskettes", "<BA2Folder_V3>", ObjectSetupStr, "REPLACE")
  108. if(res = 0) then
  109.   say "Couldn't create program reference object"
  110.  
  111. /* Create the user's guide object */
  112. say "Creating user's guide object..."
  113. ObjectSetupStr = "EXENAME=VIEW.EXE;STARTUPDIR="||BA2Path||";PARAMETERS=BA2.INF;PROGTYPE=PM"
  114. res = SysCreateObject("WPProgram", "Back Again/2^User's Guide", "<BA2Folder_V3>", ObjectSetupStr, "REPLACE")
  115. if(res = 0) then
  116.   say "Couldn't create user's guide object"
  117.  
  118. /* Create the readme file object */
  119. say "Creating READ.ME object..."
  120. ObjectSetupStr = "EXENAME=E.EXE;STARTUPDIR="||BA2Path||";PARAMETERS=READ.ME;PROGTYPE=PM"
  121. res = SysCreateObject("WPProgram", "Back Again/2^READ.ME", "<BA2Folder_V3>", ObjectSetupStr, "REPLACE")
  122. if(res = 0) then
  123.   say "Couldn't create read.me file object"
  124.  
  125. /* Register the BA2Device WPS class & create a template */
  126. res = SysRegisterObjectClass("BA2Device", "BA2DEV")
  127. if (res = 0) then
  128.   say "Couldn't register BA2Device WPS class"
  129. res = SysCreateObject("BA2Device", "Back Again/2^Backup Device", "<BA2Folder_V3>", "TEMPLATE=YES", "REPLACE")
  130. if(res = 0) then
  131.   say "Couldn't create BA2Device template"
  132.  
  133. /* Create a shadow for each set in the backup sets folder */
  134. FileMask = BA2Path||'\*.SET'
  135. res = SysFileTree(FileMask, FileList, 'FO')
  136. if(res = 0) then
  137.   if(FileList.0 > 0) then
  138.     do
  139.       /* Say what we're doing */
  140.       say "Creating backup set shadows in backup set folder..."
  141.  
  142.       /* Do it  */
  143.       do idx = 1 to FileList.0
  144.         say " - "||FileList.idx
  145.         FileName = FILESPEC("name",FileList.idx)
  146.         ObjectSetupStr = "OBJECTID=<ShadowOf_"||FileList.idx||">;SHADOWID="||FileList.idx
  147.         res = SysCreateObject("WPShadow", FileName, "<BA2Sets_V3>", ObjectSetupStr, "REPLACE")
  148.         if(res = 0) then
  149.           say "   - Couldn't create shadow, rc="res
  150.       end
  151.     end
  152.  
  153. /* We're done! */
  154. say 'Done.'
  155.