home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: InfoMgt / InfoMgt.zip / cutv20.zip / install.cmd < prev   
OS/2 REXX Batch file  |  1994-07-03  |  2KB  |  72 lines

  1. /* REXX - Installation */
  2. parse arg path
  3. Signal on Halt
  4. name = 'CutIt'
  5. files.0 = 3;
  6. files.1 = 'cutit.exe'
  7. files.2 =  'cutit.hlp'
  8. files.3='cutit.ini'
  9. exe = 1
  10.  
  11. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  12. call SysLoadFuncs
  13.  
  14. if path = '' then do
  15.   ret = SysIni('SYSTEM', 'FolderWorkareaRunningObjects', 'ALL:', 'Desktop')
  16.   if ret <> '' | Desktop.0 <> 1 then do                                    
  17.     say 'Error locating Desktop, C:\' || name || ' will be used as a default'
  18.     path = 'C:\' || name
  19.   end
  20.   else path = left(Desktop.1, 2) || '\' || name
  21. end
  22.  
  23. r = 0
  24. p = ''
  25. do until p = ''
  26. say path
  27.   if SysFileTree(path, 'dir.', 'DO') then do
  28.     say '*** Error ***'
  29.     r = 99
  30.     call halt
  31.   end
  32.   if dir.0 > 0 then
  33.     msg = 'EXISTS.'
  34.   else msg = 'will be CREATED.'
  35.   say name 'will be installed in' translate(path) || '. The directory' msg
  36.   say 'Press <Enter> to accept, <Ctrl-C><Enter> to cancel or type a new directory path'
  37.   p = strip(linein())
  38.   if p <> '' then path = p
  39. end
  40.  
  41. path = strip(path, 'T', '\')
  42. if dir.0 = 0 then do
  43.   '@md 1>nul 2>nul' path
  44.   if rc <> 0 then do
  45.     say '*** ERROR *** Could not create directory' path
  46.     r = 99
  47.     call halt
  48.   end
  49. end
  50.  
  51. if directory() <> path then
  52.   do i = 1 to files.0
  53.     '@copy' files.i path
  54.   end
  55.  
  56. setup = 'EXENAME=' || path || '\' || files.exe || ';STARTUPDIR=' || path
  57. if SysCreateObject('WPProgram', name, '<WP_DESKTOP>', setup, 'F') then
  58.   say name 'has been created on your DESKTOP.'
  59. else do
  60.  say 'The program object' name 'could not be created, possible duplicate'
  61.  r = 99
  62.  call halt
  63. end
  64.  
  65. if r = 0 then say 'Install completed'
  66. '@pause'
  67. return r
  68. halt:
  69. say 'Install cancelled'
  70. '@pause'
  71.  
  72.