home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / mems400b.zip / mem4b.zip / English.cmd < prev    next >
OS/2 REXX Batch file  |  1997-10-23  |  4KB  |  162 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( 'MEMSIZE2.EXE', 'Files', 'F' )
  28. If Files.0 = 0 Then
  29.   Do
  30.   Say 'ERROR: MEMSIZE2.EXE not found!'
  31.   Signal DONE
  32.   End
  33.  
  34. Result = SysFileTree( "OBJECTS.OS2\"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( "OBJECTS.OS2\"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. BootDrive = Filespec('Drive',Value('SYSTEM_INI',,'OS2ENVIRONMENT'))
  51. Default = SysIni('USER', 'MEMSIZE', 'INIPATH' )
  52. If Default = 'ERROR:'
  53.   Then Default = BootDrive'\OS2\Apps'
  54. If SUBSTR(Default,LENGTH(Default),1) <= ' '
  55.   Then Default = SUBSTR(Default,1,LENGTH(Default)-1)
  56.  
  57. Say 'Please enter the full name of the directory to which'
  58. Say '  you want MEMSIZE installed (default 'Default'): '
  59. Parse Pull Directory
  60. If Directory = "" Then Directory = Default
  61.  
  62.  
  63. /* Create the target directory if necessary. */
  64.  
  65. Result = SysFileTree( Directory, 'Dirs', 'D' )
  66. If Dirs.0 = 0 Then
  67.   Do
  68.   Result = SysMkDir( Directory )
  69.   if Result == 0 Then
  70.     Do
  71.     End
  72.   Else
  73.     Do
  74.     Say 'ERROR: Unable to create target directory.'
  75.     Signal DONE
  76.     End
  77.   End
  78. Say ''
  79.  
  80.  
  81. /* Save the target directory. */
  82.  
  83. SysIni( "USER", "MEMSIZE", "INIPATH", Directory )
  84. SysIni( Directory"\MEMSIZE2.INI", "MEMSIZE", "INIPATH", Directory )
  85.  
  86.  
  87. /* Ask for the target folder. */
  88.  
  89. Say 'Do you wish to install to the startup folder? (Y/N)'
  90. Pull YesNo
  91. If YesNo = "Y" Then
  92.   Do
  93.   Folder = '<WP_START>'
  94.   Say 'Object will be placed in the startup folder.'
  95.   End
  96. Else
  97.   Do
  98.   Folder = '<WP_DESKTOP>'
  99.   Say 'Object will be placed on the desktop.'
  100.   End
  101. Say ''
  102.  
  103.  
  104. /* Destroy the old object, if present. */
  105.  
  106. Call SysDestroyObject( '<MEMSIZE>' )
  107. Call SysSleep( 5 )
  108.  
  109.  
  110. /* Perform the installation. */
  111.  
  112. Say 'Copying MEMSIZE to 'Directory' ...'
  113. Copy MEMSIZE2.EXE Directory '1>NUL'
  114. Copy "OBJECTS.OS2\"Language".DLL" Directory"\MEMSIZE2.DLL" '1>NUL'
  115. Copy "OBJECTS.OS2\"Language".HLP" Directory"\MEMSIZE2.HLP" '1>NUL'
  116. Copy Language".DOC" Directory"\MEMSIZE2.DOC" "1>NUL"
  117.  
  118. Result = SysFileTree( "HLP2INF.EXE", 'Files', 'F' )
  119. If Files.0 > 0 Then
  120.    Do
  121.    Result = SysFileTree( Directory"\MEMSIZE2.INF", 'Files', 'F' )
  122.    If Files.0 > 0 Then
  123.       Do
  124.       "Erase" Directory"\MEMSIZE2.INF"
  125.       End
  126.    "HLP2INF" Directory"\MEMSIZE2.HLP"
  127.    End
  128.  
  129. Result = SysFileTree( "SNPSHOT2.EXE", 'Files', 'F' )
  130. If Files.0 > 0 Then
  131.    Do
  132.    Copy "SNPSHOT2.EXE" Directory"\SNPSHOT2.EXE"  '1>NUL'
  133.    End
  134.  
  135. Say 'Creating program object...'
  136. Type = 'WPProgram'
  137. Title = 'System Resources'
  138. Parms = 'OPEN=DEFAULT;MINWIN=DESKTOP;PROGTYPE=PM;EXENAME='Directory'\MEMSIZE2.EXE;STARTUPDIR='Directory';OBJECTID=<MEMSIZE>;NOPRINT=YES;'
  139. Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  140.  
  141. If Result = 1 Then
  142.   Say 'Object created!  Done.'
  143. Else
  144.   Say 'ERROR: Object not created.'
  145.  
  146. Signal DONE
  147.  
  148. FAILURE:
  149. Say 'REXX failure.'
  150. Signal DONE
  151.  
  152. HALT:
  153. Say 'REXX halt.'
  154. Signal DONE
  155.  
  156. SYNTAX:
  157. Say 'REXX syntax error.'
  158. Signal DONE
  159.  
  160. DONE:
  161. Exit
  162.