home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 7 Games / 07-Games.zip / seahav23.zip / Install.CMD next >
OS/2 REXX Batch file  |  1995-06-15  |  4KB  |  139 lines

  1. /* SeaHaven Towers for OS/2 installation program */
  2.  
  3.   Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4.   Call SysLoadFuncs
  5.  
  6.   Parse Arg InstallDir SeaVer
  7.   Signal On Halt Name ErrorHandler
  8.  
  9.   Say " "
  10.   Say " "
  11.   Say " "
  12.   Say " SeaHaven Towers for OS/2 Installation"
  13.  
  14.   If InstallDir=" " Then Do
  15.     Say
  16.     Say " Please specify the name of the subdirectory to"
  17.     Say " which you would like to install SeaHaven Towers,"
  18.     Say " hit <ENTER> to use the current directory, or type"
  19.     Say " 'Q'<ENTER> to quit."
  20.     Say " "
  21.     Say " For Example:  C:\SEAHAVEN<ENTER>"
  22.     Say " "
  23.     Say " Directory to install to:"
  24.  
  25.     Parse Value SysCurPos() with Row Col
  26.     Col=Col+26
  27.     Row=Row-1
  28.     Call SysCurPos Row, Col
  29.     Pull InstallDir
  30.     If (InstallDir="Q")|(InstallDir="q") Then Exit
  31.   End
  32.  
  33.   If InstallDir=" " Then InstallDir=directory()
  34.  
  35.   Else Do
  36.  
  37.     Call SysFileTree InstallDir, FileDirectory, 'D'
  38.  
  39.     If FileDirectory.0='0' Then Do
  40.       Say
  41.       Say " Now creating directory "InstallDir" . . ."
  42.       rc=SysMkDir(InstallDir)
  43.       If rc\=0 Then Do
  44.         Say " "
  45.         Say " Error creating directory "InstallDir" . . ."
  46.         Say " You may have specified an invalid directory name."
  47.         Say " Rerun install to try again."
  48.         Exit
  49.       End
  50.     End
  51.    End
  52.  
  53.   If SeaVer=" " Then Do
  54.     Say
  55.     Say " Which version of SeaHaven Towers would you like to install:"
  56.     Say " "
  57.     Say " 'C'<ENTER>  Compatible with OS/2 2.x and higher.   (560K)"
  58.     Say " 'W'<ENTER>  Only works with OS/2 Warp.             (240K)"
  59.     Say " "
  60.     Say " Note: There is no difference in playability between the "
  61.     Say "       versions.  The Warp version only uses different "
  62.     Say "       compiler switches to significantly reduce the size "
  63.     Say "       of the executable. "
  64.     Say " "
  65.     Say " Version to install:"
  66.  
  67.     Parse Value SysCurPos() with Row Col
  68.     Col=Col+21
  69.     Row=Row-1
  70.     Call SysCurPos Row, Col
  71.     Pull SeaVer
  72.   End
  73.  
  74.  
  75.   Say " "
  76.   Say " Now copying files . . ."                              /* Now copy files */
  77.   Call FileUnpack 'SeaHaven.HL_', InstallDir
  78.   Call FileCopy 'ReadMe', InstallDir
  79.   if (SeaVer="C")|(SeaVer="c") then
  80.     Call FileUnpack 'SeaHaven.EX_', InstallDir
  81.   else if (SeaVer="W")|(SeaVer="w") then
  82.     Call FileUnpack 'SeaWarp.EX_', InstallDir
  83.   else do
  84.     Say SeaVer" is not a valid version."
  85.     Say "Rerun Install."
  86.     Exit
  87.   End
  88.   Say " "
  89.   Say " Now creating WPS program object . . ."                  /* Now create the Desktop object*/
  90.   SetupString="EXENAME="InstallDir"\SeaHaven.EXE;STARTUPDIR="InstallDir
  91.  
  92.   rc=SysCreateObject("WPProgram","SeaHaven Towers","<WP_DESKTOP>",SetupString)
  93.   If rc=0 Then Do
  94.     Say
  95.     Say " Sorry, couldn't create the SeaHaven Tpwers program object."
  96.     Say " You may already have a SeaHaven Towers program object on your"
  97.     Say " Desktop.  Delete this object and rerun install. "
  98.     Exit
  99.   End
  100.  
  101.   Say
  102.   Say " SeaHaven Towers for OS/2 successfully installed."
  103.  
  104.   Exit
  105.  
  106.  
  107. /******* FileCopy procedure */
  108.  
  109.   FileCopy: Arg FileName, Destination
  110.  
  111.     Command='@Copy 'FileName' 'Destination' >NUL'
  112.     Command
  113.     Return
  114.  
  115. /******** FileUnpack procedure ********/
  116.   FileUnpack: Arg FileName, Destination
  117.  
  118.     Command='@Unpack 'FileName' 'Destination' >NUL'
  119.     Command
  120.     if rc\=0 Then Do
  121.         Say " "
  122.         Say " Error unpacking file "FileName".  Make sure "
  123.         Say " this file is in the current directory and "
  124.         Say " rerun install."
  125.         exit
  126.      End
  127.      Return
  128.  
  129.  
  130. /******* ErrorHandler procedure */
  131.  
  132.   ErrorHandler:
  133.  
  134.     Call SysCls
  135.     Say "Unknown error - aborting installation . . ."
  136.     Say "Contact the author with details please."
  137.   Exit
  138.  
  139.