home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / memsz331.zip / ENGLISH.CMD < prev    next >
OS/2 REXX Batch file  |  1996-07-26  |  3KB  |  161 lines

  1. /* ENGLISH.CMD: Install MEMSIZE in English. */
  2.  
  3. '@Echo Off'
  4. 'CHCP 850'
  5.  
  6. /* Load REXXUTIL */
  7.  
  8. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  9. Call SysLoadFuncs
  10.  
  11.  
  12. /* Initialize */
  13.  
  14. Signal On Failure Name FAILURE
  15. Signal On Halt Name HALT
  16. Signal On Syntax Name SYNTAX
  17.  
  18. Call SysCls
  19. Say 'Installing MEMSIZE...'
  20. Say ''
  21.  
  22.  
  23. /* Verify the existence of the various component files. */
  24.  
  25. Language = 'ENGLISH'
  26.  
  27. Result = SysFileTree( 'MEMSIZE.EXE', 'Files', 'F' )
  28. If Files.0 = 0 Then
  29.   Do
  30.   Say 'ERROR: MEMSIZE.EXE not found!'
  31.   Signal DONE
  32.   End
  33.  
  34. Result = SysFileTree( Language".DLL", 'Files', 'F' )
  35. If Files.0 = 0 Then
  36.   Do
  37.   Say 'ERROR: 'Language'.DLL not found!'
  38.   Signal DONE
  39.   End
  40.  
  41. Result = SysFileTree( Language".HLP", 'Files', 'F' )
  42. If Files.0 = 0 Then
  43.   Do
  44.   Say 'ERROR: 'Language'.HLP not found!'
  45.   Signal DONE
  46.   End
  47.  
  48. /* Ask for the target directory name. */
  49.  
  50. Default = SysIni('USER', 'MEMSIZE', 'INIPATH' )
  51. If Default = 'ERROR:'
  52.   Then Default = 'C:\OS2\Apps'
  53. If SUBSTR(Default,LENGTH(Default),1) <= ' '
  54.   Then Default = SUBSTR(Default,1,LENGTH(Default)-1)
  55.  
  56. Say 'Please enter the full name of the directory to which'
  57. Say '  you want MEMSIZE installed (default 'Default'): '
  58. Parse Pull Directory
  59. If Directory = "" Then Directory = Default
  60.  
  61.  
  62. /* Create the target directory if necessary. */
  63.  
  64. Result = SysFileTree( Directory, 'Dirs', 'D' )
  65. If Dirs.0 = 0 Then
  66.   Do
  67.   Result = SysMkDir( Directory )
  68.   if Result == 0 Then
  69.     Do
  70.     End
  71.   Else
  72.     Do
  73.     Say 'ERROR: Unable to create target directory.'
  74.     Signal DONE
  75.     End
  76.   End
  77. Say ''
  78.  
  79.  
  80. /* Save the target directory. */
  81.  
  82. SysIni( "USER", "MEMSIZE", "INIPATH", Directory )
  83. SysIni( Directory"\MEMSIZE.INI", "MEMSIZE", "INIPATH", Directory )
  84.  
  85.  
  86. /* Ask for the target folder. */
  87.  
  88. Say 'Do you wish to install to the startup folder? (Y/N)'
  89. Pull YesNo
  90. If YesNo = "Y" Then
  91.   Do
  92.   Folder = '<WP_START>'
  93.   Say 'Object will be placed in the startup folder.'
  94.   End
  95. Else
  96.   Do
  97.   Folder = '<WP_DESKTOP>'
  98.   Say 'Object will be placed on the desktop.'
  99.   End
  100. Say ''
  101.  
  102.  
  103. /* Destroy the old object, if present. */
  104.  
  105. Call SysDestroyObject( '<MEMSIZE>' )
  106. Call SysSleep( 5 )
  107.  
  108.  
  109. /* Perform the installation. */
  110.  
  111. Say 'Copying MEMSIZE to 'Directory' ...'
  112. Copy MEMSIZE.EXE Directory                  '1>NUL'
  113. Copy Language".DLL" Directory"\MEMSIZE.DLL" '1>NUL'
  114. Copy Language".HLP" Directory"\MEMSIZE.HLP" '1>NUL'
  115. Copy Language".DOC" Directory"\MEMSIZE.DOC" "1>NUL"
  116.  
  117. Result = SysFileTree( "HLP2INF.EXE", 'Files', 'F' )
  118. If Files.0 > 0 Then
  119.    Do
  120.    Result = SysFileTree( Directory"\MEMSIZE.INF", 'Files', 'F' )
  121.    If Files.0 > 0 Then
  122.       Do
  123.       "Erase" Directory"\MEMSIZE.INF"
  124.       End
  125.    "HLP2INF" Directory"\MEMSIZE.HLP"
  126.    End
  127.  
  128. Result = SysFileTree( "SNAPSHOT.EXE", 'Files', 'F' )
  129. If Files.0 > 0 Then
  130.    Do
  131.    Copy "SNAPSHOT.EXE" Directory"\SNAPSHOT.EXE"  '1>NUL'
  132.    End
  133.  
  134. Say 'Creating program object...'
  135. Type = 'WPProgram'
  136. Title = 'System Resources'
  137. Parms = 'OPEN=DEFAULT;MINWIN=DESKTOP;PROGTYPE=PM;EXENAME='Directory'\MEMSIZE.EXE;STARTUPDIR='Directory';OBJECTID=<MEMSIZE>;NOPRINT=YES;'
  138. Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  139.  
  140. If Result = 1 Then
  141.   Say 'Object created!  Done.'
  142. Else
  143.   Say 'ERROR: Object not created.'
  144.  
  145. Signal DONE
  146.  
  147. FAILURE:
  148. Say 'REXX failure.'
  149. Signal DONE
  150.  
  151. HALT:
  152. Say 'REXX halt.'
  153. Signal DONE
  154.  
  155. SYNTAX:
  156. Say 'REXX syntax error.'
  157. Signal DONE
  158.  
  159. DONE:
  160. Exit
  161.