home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / kazip1.zip / install.exe / Install.cmd < prev    next >
OS/2 REXX Batch file  |  1997-10-18  |  3KB  |  107 lines

  1. /*  ---------------------------------------------------------------------------------
  2.  *  K.A.Ash (c) June 17th 1996
  3.  *
  4.  *  install script for KZipper
  5.  *  --------------------------------------------------------------------------------- */
  6.  
  7. signal on halt name SignalHandler       /* Exception handler */
  8.  
  9. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  10. call SysLoadFuncs
  11.  
  12. FileName = SysSearchPath('PATH', 'KAZip.exe')
  13. if FileName = '' then
  14. do
  15.    say 'Error: Cannot find KAZip.exe in PATH directories.'
  16.    exit
  17. end
  18.  
  19. /* check if have unzip */
  20. if SysSearchPath('PATH', 'unzip.exe') ='' then
  21. do
  22.    Say "  Info-Zip's unzip is required to extract files that aren't stored or deflated( method 8). ",,
  23.        "Unzip.exe will also be required to extract encrypted entries( unless you compile(",,
  24.        " or get hold of) a non dummy KACrypt.dll."
  25.    Say;
  26. end
  27.  
  28. /*do until GOTDIR = 2*/
  29. DEST=''
  30. do while DEST=''
  31.   DEST = GetAnswer( "<WP_DESKTOP>", "Enter directory to install KAZip program objects" )
  32.   /* make dir fully qualified */
  33.   if( SubStr( DEST,1,1) \= '<' & SubStr( DEST,2,2)\=':\' ) then do
  34.     DEST = GetFullQualifiedPath( DEST )
  35.   end
  36.  
  37.   /* should check if destination is valid dir */
  38.   if( DEST = '' ) then Say "Invalid directory selected"
  39. end /* do while */
  40.  
  41. SAY DEST
  42. /* should really check all return codes */
  43. if ( SysCreateObject( 'WPFolder',,
  44.                  'KAZip', DEST,,
  45.                  'OBJECTID=<KZipperFolder>',,
  46.                   'f' ) != 1 ) then do
  47.     Say "installation failed"
  48.     exit
  49. end
  50.  
  51. rc=SysCreateObject('WPProgram',,
  52.                 'KAZip', '<KZipperFolder>',,
  53.                 'OBJECTID=<KZipper>;STARTUPDIR='directory()';ASSOCFILTER=*.ZIP;ASSOCTYPE=Zip Archive;EXENAME='FileName ,,
  54.                   'u' )
  55. rc=SysCreateObject('WPProgram',,
  56.                 'KAZip Extract to', '<KZipperFolder>',,
  57.                 'OBJECTID=<KZipperExtractTo>;STARTUPDIR='directory()';ASSOCFILTER=*.ZIP;ASSOCTYPE=Zip Archive;PARAMETERS=/EXTRACT;EXENAME='FileName ,,
  58.                 'u' )
  59.  
  60.  
  61. if SysSearchPath('PATH', 'e.exe') \='' then
  62. do
  63.   ANS = SubStr( GetAnswer( "Y", "View KAZip.txt now(Y/N) ?" ), 1, 1)
  64.   if (  (ANS = 'Y') | (ANS = 'y') ) then
  65.       "e.exe KAZip.txt"
  66. end
  67. exit
  68.  
  69.  
  70. GetAnswer:
  71.  parse arg DEFAULT, MSG
  72.  
  73.  say;
  74.  call Charout, MSG '['DEFAULT'] : ';
  75.  parse pull ANS;
  76.  if (Length(ANS) > 0) then
  77.     return(ANS);
  78.  else
  79.     return(DEFAULT);
  80.  
  81. GetFullQualifiedPath:
  82.  parse arg SRC
  83.  DEST = ''
  84.  if( SubStr( SRC,2,1) = ':' ) then do
  85.      CURDIR = Directory()
  86.      NEWDIR = Directory( SubStr(SRC,1,2) )
  87.      if( Length( NEWDIR) = 3 & SubStr( NEWDIR,3,1) = '\' ) then
  88.         NEWDIR = SubStr( NEWDIR, 1,2 )
  89.      if( NEWDIR \= '' ) then do
  90.         DEST = NEWDIR'\'SubStr( SRC,3)
  91.      end  /* Do */
  92.      call Directory CURDIR
  93.  end  /* Do */
  94.  else do
  95.      DIR = Directory()
  96.      if( Length( DIR) = 3 & SubStr( DIR,3,1) = '\' ) then
  97.         DIR = SubStr( DIR, 1,2 )
  98.      DEST = DIR'\'SRC
  99.  end  /* Do */
  100. return (DEST)
  101.  
  102. SignalHandler:
  103.   call SysCls
  104.   Say ;
  105.   Say "error - exiting..."
  106.   exit
  107.