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

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