home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / upsmon2.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1999-07-19  |  3KB  |  99 lines

  1. /* INSTALL.CMD */
  2. /* This program places a UPSMonitor folder on the
  3.    desktop and fills it with the UPSMONS
  4.    program objects.
  5. */
  6.  
  7. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8. call SysLoadFuncs
  9.  
  10. SAY 'Installing UPS Monitor...'
  11. SAY ''
  12.  
  13. objerror = 0
  14. folder.name = 'UPSMonitor'
  15.  
  16. pwd = Directory()
  17. execs.0 = 2
  18. execs.1.spec = pwd || '\*.exe'
  19. execs.1._title = ''
  20. execs.2.spec = pwd || '\*.txt'
  21. execs.2._title = '0A'x || 'UPSMon'
  22.  
  23.  
  24. folder.objId = Translate(folder.name, '__', '^ ')
  25. folder.title  = Translate(folder.name, '0A'x, '^')
  26.  
  27. rc = SysCreateObject('WPFolder', folder.title,,
  28.     '<WP_DESKTOP>',,
  29.     'OBJECTID=<' || folder.objId || '>;' ||,
  30.     'ICONVIEW=NORMAL;ICONFONT=8.Helv;',,
  31.     'ReplaceIfExists')
  32.  
  33. IF rc = 0 THEN
  34.   DO
  35.     SAY ''
  36.     SAY 'Could not create folder' folder.name
  37.     EXIT
  38.   END
  39.  
  40. DO i = 1 TO execs.0
  41.   CALL SysFileTree execs.i.spec, 'files.', 'FO'
  42.   DO j = 1 TO files.0
  43.     title = Translate(Reverse(FileSpec('Name', files.j)))
  44.     PARSE VAR title 5 title
  45.     title = Reverse(title) || execs.i._title
  46.     IF title = 'UPSMONB' then
  47.       title = 'UPSMon B^(for Back-UPS only)'
  48.     IF title = 'UPSMONS' then
  49.       title = 'UPSMonitor'
  50.     IF title = 'README' then
  51.       title = 'UPSMon^Readme'
  52.     parm = ''
  53.     IF POS('README.TXT', Translate(files.j)) > 0 | POS('BMTORDER.TXT', Translate(files.j)) > 0 then
  54.      DO
  55.        parm = 'STARTUPDIR=' || pwd || ';PARAMETERS=' || files.j || ';'
  56.        files.j = 'E.EXE'
  57.      END
  58.     ELSE
  59.        parm = 'STARTUPDIR=' || pwd || ';'
  60.  
  61.     rc = SysCreateObject('WPProgram', title,,
  62.     '<'folder.objId'>',,
  63.     'EXENAME=' || files.j || ';' ||,
  64.         parm,,
  65.     'ReplaceIfExists')
  66.     IF rc = 0 THEN
  67.       DO
  68.         SAY 'Could not create program object for' files.j
  69.         objerror = objerror + 1
  70.       END
  71.   END
  72. END
  73.  
  74. SAY ''
  75. IF objerror = 0 then
  76.   DO
  77.     SAY 'UPSMonitor folder and program objects successfully created.'
  78.     SAY ''
  79.     SAY '       ======= I M P O R T A N T ======='
  80.     SAY ''
  81.     SAY 'Please read the README.TXT file first.'
  82.     SAY ''
  83.     SAY 'To read README.TXT, open UPSMonitor folder'
  84.     SAY 'and double-click on README UPSMon object.'
  85.     SAY ''
  86.     SAY 'To start UPS Monitor, double-click on the UPS Monitor icon.'
  87.     SAY 'Please read the online Help to learn how to use UPS Monitor.'
  88.   END
  89. ELSE
  90.   DO
  91.     SAY 'Could not install one or more UPSMon objects.'
  92.     SAY ''
  93.     SAY 'Make sure all UPSMon files are present'
  94.     SAY 'and run INSTALL again.'
  95.   END
  96.  
  97. EXIT
  98.  
  99.