home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ice2chat.zip / ICE2Chat.cmd next >
OS/2 REXX Batch file  |  1997-05-07  |  4KB  |  141 lines

  1. /* MR/2 ICE filter append for NetChat/2 */
  2.  
  3. Main:
  4.     signal on halt
  5. call rxfuncadd 'sysloadfuncs','rexxutil','sysloadfuncs' 
  6. call sysloadfuncs
  7.  
  8. call SysCls
  9. say 'MR/2 ICE filter append for NetChat/2'
  10. say 'Written by: Lawrence Lucier (lucier@bossie.cow-net.com)'   
  11. say '             Barry Adams (barry@inorbit.com)                April 30th 1997'
  12. say
  13. say
  14. say 'These available drive designations where found:'
  15. say SysDriveMap('C:', 'USED')
  16. say
  17. say 'Which drive is MR/2 ICE installed on? (Type letter only)'
  18. pull Mr2IceDrive
  19. call SysCls
  20. say
  21. say 'Scanning '||Mr2IceDrive||': for copies of MR/2 ICE filter files.....please wait!'         
  22. say
  23. say
  24. rc = CALL SysFileTree(Mr2IceDrive||':\mr2i.flt', 'file', 'SO')
  25. say file.0
  26. if file.0 > 0 then
  27. do
  28. call SysSleep 3
  29.   do i=1 to file.0
  30.    CALL SysCls
  31.    CALL FileSpecs
  32.    say
  33.    say 
  34.    say "Found "||ProgramFile||' in '||HardDrive||FilePath
  35.    say 'Do you wish to update this copy of mr2i.flt?(y/n)'
  36.    parse pull answer
  37.         if answer = 'n'
  38.             then 
  39.             iterate i;
  40.        else
  41.  
  42. CALL ChangeToNewDirectory
  43. CALL MakeOpenNCcommandFile
  44. CALL FileSpecs
  45. CALL AppendFilterLine
  46. end
  47. exit 
  48. end
  49. else
  50. /*  Branching code for when no MR2I.FLT files exist................BEGINS */
  51.  
  52. say file.0              
  53. say 'Scanning '||Mr2IceDrive||': for MR/2ICE directory.....please wait!'         
  54. say
  55. say
  56. pc = CALL SysFileTree(Mr2IceDrive||':\mr2i.exe', 'file', 'SO')
  57. call SysSleep 3
  58.   do i=1 to file.0
  59.    CALL SysCls
  60.    CALL FileSpecs
  61.    say
  62.    say 
  63.    say "Found "||ProgramFile||' in '||HardDrive||FilePath
  64.    say 'Do you wish to update this MR2ICE directory?(y/n)'
  65.    parse pull answer
  66.         if answer = 'n'
  67.             then 
  68.             iterate i;
  69.        else
  70.  
  71. CALL ChangeToNewDirectory
  72. CALL MakeOpenNCcommandFile
  73. CALL FileSpecs
  74. CALL WriteNewFilterFile
  75. end
  76. exit 
  77.  
  78.  
  79. /*  Branching code for when no MR2I.FLT files exist................ENDS */
  80.  
  81.  
  82. WriteNewFilterFile:
  83. Change_Slash = translate(FilePath,  '/',  '\')||'opennc.cmd'
  84. ChangeSlashes = translate(Change_Slash)
  85. rc = LINEOUT(mr2i.flt,'+NetChat\nchat\8\NETCHATMSG\\\Default Reply Template\\nchat\'||HardDrive||ChangeSlashes||'\0\0\FSMYNNNNNNNYAM')
  86. rc = LINEOUT(mr2i.flt)
  87. return
  88.  
  89. FileSpecs:
  90. FoundFile = file.i
  91. FilePath = filespec("PATH",FoundFile)
  92. HardDrive = filespec("DRIVE",FoundFile) 
  93. ProgramFile=filespec("NAME",FoundFile)
  94. return
  95.  
  96. ChangeToNewDirectory:
  97. NewDirString = strip(FilePath,t,'\')
  98. NewDirectory = HardDrive||NewDirString
  99. say
  100. say 
  101. call directory(NewDirectory)
  102. say 'Changed over to:  '||NewDirectory
  103. say
  104. return
  105.  
  106. AppendFilterLine:
  107. say 'Making backup copy of original MR2I.FLT file.....renamed to MR2I_FLT.ORG'
  108. '@copy mr2i.flt /A mr2i_flt.org'
  109. say
  110. say 
  111. myfile=ProgramFile
  112. Change_Slash = translate(FilePath,  '/',  '\')||'opennc.cmd'
  113. ChangeSlashes = translate(Change_Slash)
  114. ReplacementString = '+NetChat\nchat\8\NETCHATMSG\\\Default Reply Template\\nchat\'||HardDrive||ChangeSlashes||'\0\0\FSMYNNNNNNNYAM'
  115. say 
  116. say 
  117. rc = LINEOUT(myfile,ReplacementString)
  118. rc = LINEOUT(myfile)
  119. say ProgramFile||' in '||HardDrive||FilePath||' successfully updated!'
  120. call SysSleep 5
  121. return
  122.  
  123. MakeOpenNCcommandFile:                   /* writes opennc.cmd to disk */
  124. say 'Checking for existing copy of OPENNC.CMD.'
  125. DoesCmdFileExist =stream('OPENNC.CMD','c','query exists')
  126. if DoesCmdFileExist <> ' ' then do
  127. say 'OPENNC.CMD already present in directory........renaming it to OPEN_CMD.ORG!'
  128. '@copy opennc.cmd /A open_cmd.org'
  129. end
  130. say 'Writing OPENNC.CMD to disk.'
  131. rc = LINEOUT(opennc.cmd,'/*opennc*/')
  132. rc = LINEOUT(opennc.cmd,"mydirectory="||"'"||NewDirectory||"'")
  133. rc = LINEOUT(opennc.cmd,'call directory (mydirectory)')
  134. rc = LINEOUT(opennc.cmd,"'@pstat /c | find "NETCHAT.EXE" >nul'")
  135. rc = LINEOUT(opennc.cmd,'if rc \= 0 then')
  136. rc = LINEOUT(opennc.cmd,"/*it's not running therefore start it*/")
  137. rc = LINEOUT(opennc.cmd,"start 'netchat.exe -m'")
  138. rc = LINEOUT(opennc.cmd)
  139. return
  140.  
  141.