home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / wcnewice.zip / install.cmd next >
OS/2 REXX Batch file  |  1998-01-27  |  4KB  |  132 lines

  1. /**/
  2. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  3. call SysLoadFuncs
  4.  
  5. arg whatodo
  6. if whatodo == '/R' | whatodo == '-R' then signal removeit
  7.  
  8. signal on halt name cleanup
  9.  
  10. say 'This script creates program objects for MR/2 ICE and the MR/2 ICE'
  11. say 'WarpCenter Notifier, and puts a shadow of the Notifier in your OS/2'
  12. say 'startup folder.'
  13. say ''
  14. say 'Stand by... locating MR/2 ICE program and data directories...'
  15. icedir = finddirof('MR2ITF.ORG')
  16. if icedir = '' then do
  17.     say "I can't find your MR/2 ICE data directory.  Sorry."
  18.     exit 1
  19. end
  20. say 'Found MR/2 ICE data directory:' icedir
  21. if stream(icedir'MR2I.EXE', 'C', 'QUERY EXISTS') \== '' then
  22.     icebin = icedir
  23. else do
  24.     icebin = SysSearchPath('PATH', 'MR2I.EXE')
  25.     if icebin == '' then do
  26.     icebin = finddirof('MR2I.EXE')
  27.     if icebin = '' then do
  28.         say "I can't find your MR/2 ICE program directory.  Sorry."
  29.         exit 1
  30.     end
  31.     end
  32. end
  33. say 'Found MR/2 ICE program directory:' icebin
  34. say ''
  35. say 'Installing MR/2 ICE WarpCenter Notifier...'
  36. '@copy WCNewICE.EXE' icebin'WCNewICE.EXE >nul 2>&1'
  37. if rc \= 0 then do
  38.     say 'Copy of MR/2 ICE WarpCenter Notifier failed!'
  39.     exit 1
  40. end
  41. say 'Creating MR/2 ICE program object for WarpCenter...'
  42. rv = SysCreateObject('WPProgram', 'MR/2 Internet Cruiser', '<WP_DESKTOP>',,
  43.              'OBJECTID=<CCINBOX>;EXENAME='icebin'MR2I.EXE', 'R')
  44. if rv = 0 then do
  45.     say 'Creation of WarpCenter-enabled MR/2 ICE program object failed!'
  46.     exit 1
  47. end
  48. say 'Creating MR/2 ICE WarpCenter Notifier program object...'
  49. rv = SysCreateObject('WPProgram', 'MR/2 ICE WarpCenter Notifier',,
  50.              '<WP_DESKTOP>', 'OBJECTID=<MR/2_ICE_WCN>;' ||,
  51.              'EXENAME='icebin'WCNewICE.EXE;PMTYPE=PM;' ||,
  52.              'STARTUPDIR='icedir, 'R')
  53. if rv = 0 then do
  54.     say 'Creation of MR/2 ICE WarpCenter Notifier program object failed!'
  55.     exit 1
  56. end
  57. say 'Creating shadow of MR/2 ICE Warpcenter Notifier in Startup folder...'
  58. rv = SysCreateObject('WPShadow', ' ', '<WP_START>',,
  59.              'OBJECTID=<MR/2_ICE_WCN_Shadow>;SHADOWID=<MR/2_ICE_WCN>',,
  60.              'R')
  61. if rv = 0 then do
  62.     say 'Creation of MR/2 ICE WarpCenter notifier shadow failed!'
  63.     exit 1
  64. end
  65. say ''
  66. say 'The MR/2 ICE WarpCenter Notifier is now installed.  You will need to'
  67. say 'reboot to activate it, because WarpCenter only checks for the mailer'
  68. say 'object at startup (simply closing and reopening it doesn''t count).'
  69. say ''
  70. say 'The WarpCenter "new mail" indicator is immediately to the left of the'
  71. say 'Information Center icon on the right side of the WarpCenter.  It is'
  72. say 'normally empty; when WarpCenter detects new mail, the indicator shows'
  73. say 'an envelope icon.  Click on it to open or display MR/2 ICE.'
  74. exit 0
  75.  
  76. finddirof: procedure; arg name
  77. /* first, check for a common naming convention */
  78. map = SysDriveMap()
  79. do i = 1 to words(map)
  80.     dv = word(map, i)
  81.     if stream(dv'\MR2I\'name, 'C', 'QUERY EXISTS') \== '' then return dv'\MR2I\'
  82. end
  83. /* now start searching all drive toplevels */
  84. here = directory()
  85. len = length(name)
  86. do i = 1 to words(map)
  87.     dv = word(map, i)
  88.     call directory dv'\'
  89.     call SysFileTree name, 'x.', 'FO'
  90.     if x.0 = 1 then do
  91.     call directory here
  92.     return left(x.1, length(x.1) - len)
  93.     end
  94. end
  95. /* ...then get *really* nasty */
  96. do i = 1 to words(map)
  97.     dv = word(map, i)
  98.     call directory dv'\'
  99.     call SysFileTree name, 'x.', 'FOS'
  100.     if x.0 = 1 then do
  101.     call directory here
  102.     return left(x.1, length(x.1) - len)
  103.     end
  104. end
  105. drop here
  106. return ''
  107.  
  108. removeit:
  109. say 'Finding the MR/2 ICE program directory...'
  110. icebin = SysSearchPath('PATH', 'MR2I.EXE')
  111. if icebin == '' then do
  112.     icebin = finddirof('MR2I.EXE')
  113.     if icebin = '' then do
  114.     say "I can't find your MR/2 ICE program directory.  Sorry."
  115.     exit 1
  116.     end
  117. end
  118. say 'Found MR/2 ICE program directory:' icebin
  119. say ''
  120. say 'Removing the MR/2 ICE WarpCenter Notifier...'
  121. say 'If this script hangs, close the WarpCenter.'
  122. call SysDestroyObject '<MR/2_ICE_WCN_Shadow>'
  123. call SysDestroyObject '<MR/2_ICE_WCN>'
  124. call SysFileDelete icebin'WCNewICE.EXE'
  125. call SysDestroyObject '<CCINBOX>'
  126. exit 0
  127.  
  128. cleanup:
  129. say 'Interrupted.  Cleaning up...'
  130. if symbol('here') == 'VAR' then call directory here
  131. exit 99
  132.