home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / hexcal13.zip / INSTALL.CMD < prev   
OS/2 REXX Batch file  |  1994-12-26  |  2KB  |  114 lines

  1. /* INSTALL.CMD: Install Hexcalculator. */
  2.  
  3. '@Echo Off'
  4.  
  5. /* Set the installed object's title. */
  6.  
  7. Title = 'HexCalculator'
  8.  
  9.  
  10. /* Load REXXUTIL */
  11.  
  12. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  13. Call SysLoadFuncs
  14.  
  15.  
  16. /* Initialize */
  17.  
  18. Signal On Failure Name FAILURE
  19. Signal On Halt Name HALT
  20. Signal On Syntax Name SYNTAX
  21.  
  22. Call SysCls
  23. Say 'Installing HexCalculator...'
  24. Say ''
  25.  
  26. Result = SysFileTree( 'HEXCALC.EXE', 'Files', 'F' )
  27. If Files.0 = 0 Then
  28.   Do
  29.   Say 'ERROR: HEXCALC.EXE not found!'
  30.   Signal DONE
  31.   End
  32.  
  33.  
  34. Result = SysFileTree( 'HEXCALC.HLP', 'Files', 'F' )
  35. If Files.0 = 0 Then
  36.   Do
  37.   Say 'ERROR: HEXCALC.HLP not found!'
  38.   Signal DONE
  39.   End
  40.  
  41. /* Find the drive for the Default directory */
  42.  
  43. Drives = SysDriveMap(C,'LOCAL')
  44.    do words(drives)
  45.       parse var drives drive drives
  46.       directory = drive||'\OS2\APPS'
  47.       Result = SysFileTree(Directory,'Dirs','D')
  48.       If Dirs.0 > 0 Then signal ASKDIR       
  49.       end
  50.  
  51. Directory = 'C:\OS2\APPS'
  52.  
  53. /* Ask for the target directory name. */
  54. ASKDIR: 
  55. Say 'Please enter the full name of the directory to which'
  56. Say 'you want HEXCALC installed (default' Directory '):'
  57. Say 'or type Q to Quit'  
  58. Parse upper pull Direct
  59.  
  60. if Direct = "Q" Then signal DONE
  61. If Direct > "" Then Directory = Direct
  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. /* Perform the installation. */
  82.  
  83. Say 'Copying HEXCALC to ' Directory '...'
  84. Copy "HEXCALC.EXE" Directory                   '1>NUL'
  85. Copy "HEXCALC.HLP" Directory"\HEXCALC.HLP"  '1>NUL'
  86.  
  87. Say 'Creating program object...'
  88. Type = 'WPProgram'
  89. Folder = '<WP_DESKTOP>'
  90. Parms = "MINWIN=VIEWER;PROGTYPE=PM;EXENAME="Directory"\HEXCALC.EXE;STARTUPDIR="Directory";OBJECTID=<HexCalculator>;NOPRINT=YES;"
  91. Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  92.  
  93. If Result = 1 Then
  94.   Say 'Object created!  Done.'
  95. Else             
  96.   Say 'ERROR: Object not created.'
  97.  
  98. Signal DONE
  99.  
  100. FAILURE:
  101. Say 'REXX failure.'
  102. Signal DONE
  103.  
  104. HALT:
  105. Say 'REXX halt.'
  106. Signal DONE
  107.  
  108. SYNTAX:
  109. Say 'REXX syntax error.'
  110. Signal DONE
  111.  
  112. DONE:
  113. Exit
  114.