home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / escri096.zip / English.cmd < prev    next >
OS/2 REXX Batch file  |  1998-01-15  |  6KB  |  209 lines

  1. /* ENGLISH.CMD: Install ESCRIBA in English. */
  2.  
  3. '@Echo Off'
  4. 'CHCP 850'
  5.  
  6. /* Set the installed object's title. */
  7.  
  8. Title = 'Escriba 0.96d'
  9. Language = 'English'
  10. FileName = 'English'
  11.  
  12.  
  13. /* Load REXXUTIL */
  14.  
  15. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  16. Call SysLoadFuncs
  17.  
  18.  
  19. /* Initialize */
  20.  
  21. Signal On Failure Name FAILURE
  22. Signal On Halt Name HALT
  23. Signal On Syntax Name SYNTAX
  24.  
  25. Call SysCls
  26. Say 'Installing ESCRIBA...'
  27. Say ''
  28.  
  29.  
  30. /* Verify the existence of the various component files. */
  31.  
  32. Result = SysFileTree( 'ESCRIBA.EXE', 'Files', 'F' )
  33. If Files.0 = 0 Then
  34.    Do
  35.    Say 'ERROR: ESCRIBA.EXE not found!'
  36.    Signal DONE
  37.    End
  38.  
  39. Result = SysFileTree( FileName".DLL", 'Files', 'F' )
  40. If Files.0 = 0 Then
  41.    Do
  42.    Say 'ERROR: 'FileName'.DLL not found!'
  43.    Signal DONE
  44.    End
  45.  
  46. Result = SysFileTree( FileName".HLP", 'Files', 'F' )
  47. If Files.0 = 0 Then
  48.    Do
  49.    Say 'ERROR: 'FileName'.HLP not found!'
  50.    Signal DONE
  51.    End
  52.  
  53.  
  54. /* Ask for the target directory name. */
  55.  
  56. BootDrive = Filespec('Drive',Value('SYSTEM_INI',,'OS2ENVIRONMENT'))
  57. Default = SysIni('USER', 'ESCRIBA', 'INIPATH' )
  58. If Default = 'ERROR:'
  59.   Then Default = BootDrive'\OS2\Apps'
  60. If SUBSTR(Default,LENGTH(Default),1) <= ' '
  61.   Then Default = SUBSTR(Default,1,LENGTH(Default)-1)
  62.  
  63. Say 'Please enter the full name of the directory to which'
  64. Say '  you want ESCRIBA installed (default 'Default'): '
  65. Parse Pull Directory
  66. If Directory = "" Then Directory = Default
  67.  
  68.  
  69. /* Create the target directory if necessary. */
  70.  
  71. Result = SysFileTree( Directory, 'Dirs', 'D' )
  72. If Dirs.0 = 0 Then
  73.    Do
  74.    Result = SysMkDir( Directory )
  75.    if Result == 0 Then
  76.       Do
  77.       End
  78.    Else
  79.       Do
  80.       Say 'ERROR: Unable to create target directory.'
  81.       Signal DONE
  82.       End
  83.    End
  84. Say ''
  85.  
  86.  
  87. /* Save the target directory. */
  88.  
  89. SysIni( "USER", "ESCRIBA", "INIPATH", Directory )
  90.  
  91.  
  92. /* Perform the installation. */
  93.  
  94. Say 'Copying ESCRIBA to 'Directory' ...'
  95. 'Copy ESCRIBA.EXE' Directory                   '1>NUL'
  96. 'Copy ESCRIBA.ICO' Directory                   '1>NUL'
  97. 'Copy UNINSTAL.CMD' Directory                  '1>NUL'
  98. 'Copy *.DLL' Directory                         '1>NUL'
  99. 'Copy *.HLP' Directory                         '1>NUL'
  100. 'Copy 'FileName'.DOC' Directory'\ESCRIBA.DOC    1>NUL'
  101.  
  102. Result = SysFileTree( "HLP2INF.EXE", 'Files', 'F' )
  103. If Files.0 > 0 Then
  104.    Do
  105.    Result = SysFileTree( Directory"\ESCRIBA.INF", 'Files', 'F' )
  106.    If Files.0 > 0 Then
  107.       Do
  108.       "Erase" Directory"\ESCRIBA.INF"
  109.       End
  110.    "HLP2INF" Directory"\"FileName".HLP"
  111.    "Rename" Directory"\"FileName".INF ESCRIBA.INF"
  112.    End
  113.  
  114. Say 'Creating program folder...'
  115. Type = 'WPFolder'
  116. Folder = '<WP_DESKTOP>'
  117. Parms = "OBJECTID=<ESCRIBAF>;ICONFILE="Directory"\ESCRIBA.ICO;ALWAYSSORT=YES;"
  118. Result = SysCreateObject( Type, 'Escriba', Folder, Parms, 'ReplaceIfExists' )
  119. If Result != 1 Then
  120.    Say 'ERROR: Folder not created.'
  121.  
  122. Say 'Creating program object...'
  123. Type = 'WPProgram'
  124. Folder = '<ESCRIBAF>'
  125. Parms = "MINWIN=DESKTOP;PROGTYPE=PM;EXENAME="Directory"\ESCRIBA.EXE;STARTUPDIR="Directory";OBJECTID=<ESCRIBA>;NOPRINT=YES;ASSOCTYPE=Escriba,Pluma,Plain Text,Bitmap,GIF,JPG,Metafile,PCC,PCX,TIFF,HTML;ASSOCFILTER=*.TXT,*.DOC,*.ME,*.BAT,*.CMD,*.MOI,*.BMP,*.GIF,*.JPG,*.JPEG,*.JFI,*.JFIF,*.MET,*.PCC,*.PCX,*.TIF,*.TIFF;*.HTM;*.HTML;"
  126. Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  127. If Result != 1 Then
  128.    Say 'ERROR: Object not created.'
  129.  
  130. Say 'Creating documentation objects...'
  131. Type = 'WPProgram'
  132. Parms = "MINWIN=DESKTOP;PROGTYPE=PM;EXENAME="Directory"\ESCRIBA.EXE;STARTUPDIR="Directory";OBJECTID=<ESCRIBAD>;PARAMETERS=ESCRIBA.DOC"
  133. Result = SysCreateObject( Type, "Read Me", Folder, Parms, 'ReplaceIfExists' )
  134. If Result != 1 Then
  135.    Say 'ERROR: Documentation object not created.'
  136.  
  137. Result = SysFileTree( Directory"\ESCRIBA.INF", 'Files', 'F' )
  138. If Files.0 > 0 Then Do
  139.    Type = 'WPProgram'
  140.    Parms = "MINWIN=DESKTOP;PROGTYPE=PM;EXENAME=VIEW.EXE;STARTUPDIR="Directory";OBJECTID=<ESCRIBAI>;PARAMETERS=ESCRIBA.INF Introduction;"
  141.    Result = SysCreateObject( Type, "Escriba User's Reference", Folder, Parms, 'ReplaceIfExists' )
  142.    If Result != 1 Then Do
  143.       Say 'ERROR: Documentation object not created.'
  144.       End
  145.    End
  146.  
  147.  
  148. /* Initialize the INI file, setting the default language. */
  149.  
  150. Result = SysIni( Directory"\ESCRIBA.INI", "ESCRIBA", "Language", Language )
  151. If Result = 'ERROR:' Then Do
  152.    Say 'ERROR: Language preference not saved.'
  153.    End
  154.  
  155.  
  156. /* See if the spell checker is present. */
  157.  
  158. Speller = 1
  159. Result = SysFileTree( "ISPELLER.DLL", 'Library', 'F' )
  160. If Library.0 = 0 Then Speller = 0
  161.  
  162. Result = SysFileTree( "BUILDHAS.EXE", 'Builder1', 'F' )
  163. Result = SysFileTree( "BUILDHASH.EXE", 'Builder2', 'F' )
  164. If ( ( Builder1.0 = 0 ) & ( Builder2.0 = 0 ) ) Then Speller = 0
  165.  
  166.  
  167. /* Install the spell checker, if present. */
  168.  
  169. If Speller = 1 Then Do
  170.    Say 'Installing spell checker...'
  171.    'Copy ISPELLER.DLL' Directory '1>NUL'
  172.    If Builder1.0 Then 
  173.       'Copy BUILDHAS.EXE' Directory '1>NUL'
  174.    Else 
  175.       'Copy BUILDHASH.EXE' Directory'\BUILDHAS.EXE 1>NUL'
  176.    'Copy *.AFF' Directory '1>NUL'
  177.    'Copy *.DIC' Directory '1>NUL'
  178.    Result = SysFileTree( Directory"\*.AFF", 'Affix', 'FO' ) 
  179.    Do Index=1 To Affix.0
  180.       LanguageName = SUBSTR(Affix.Index,1,LENGTH(Affix.Index)-4)
  181.       DictionaryPath = LanguageName".DIC"
  182.       Do While ( \ ( POS('\',LanguageName) = 0 ) )
  183.          LanguageName = SUBSTR(LanguageName,POS('\',LanguageName)+1)
  184.          End /* do */
  185.       Result = SysFileTree( DictionaryPath, 'Dictionary', 'FO' )
  186.       If Dictionary.0 = 1 Then Do
  187.          Say 'Building dictionary for' LanguageName'. . .'
  188.          Directory'\BUILDHAS -s' Dictionary.1 Affix.Index Directory'\'LanguageName'.HSH 1>NUL'
  189.          End /* if */
  190.       End /* do */
  191.    End /* if */
  192.  
  193. Signal DONE
  194.  
  195. FAILURE:
  196. Say 'REXX failure.'
  197. Signal DONE
  198.  
  199. HALT:
  200. Say 'REXX halt.'
  201. Signal DONE
  202.  
  203. SYNTAX:
  204. Say 'REXX syntax error.'
  205. Signal DONE
  206.  
  207. DONE:
  208. Exit
  209.