home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / fido / spot / rexx / quotepercent.spot < prev    next >
Text File  |  1994-05-23  |  2KB  |  68 lines

  1. /*******************************************************************/
  2. /*              QuotePercent v1.0 calculator for Spot              */
  3. /*                    written: May 22th 1994 by                    */
  4. /*               Kent Hansen  (2:230/418.31@FIDONET)               */
  5. /*                e-mail: kent.hansen@scala.pink.dk                */
  6. /*                                                                 */
  7. /* This script calculates the percentage of quoted characters in a */
  8. /* message, and put up a requester showing the percentage          */
  9. /********************************************************************/
  10.  
  11.  
  12. ADDRESS spot
  13. OPTIONS results
  14.  
  15. 'lockgui'
  16.  
  17. /* Check for, and load libraries */
  18. IF ~EXISTS('LIBS:rexxsupport.library') THEN DO
  19.   'requestnotify "Please install the rexxsupport.library in your LIBS: directory"'
  20.   CALL quit
  21. END
  22. CALL ADDLIB('rexxsupport.library',0,-30,0)
  23. IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO
  24.   'requestnotify "Please install the rexxreqtools.library in your LIBS: directory"'
  25.   CALL quit
  26. END
  27. CALL ADDLIB('rexxreqtools.library',0,-30,0)
  28.  
  29.  
  30. /* Check if Spot is in the messagewindow */
  31. 'ismessages'
  32. IF rc~=0 THEN DO
  33.   'requestnotify "Please use only while viewing a message" center'
  34.   CALL quit
  35. END
  36.  
  37. saveascii 'T:Spot_1.tmp' overwrite noheader notearline nokludges
  38.  
  39. 'getfrom'
  40. name=result
  41.  
  42.  
  43. /* Check for quoted and new characters, skip the tagline */
  44. CALL OPEN('infile','T:Spot_1.tmp','READ')
  45. quoted=0; new=0;
  46. currentline=READLN('infile')
  47. DO WHILE ~EOF('infile') & ~(LEFT(currentline,4)='... ')
  48.   IF RIGHT(WORD(currentline,1),1)='>' THEN quoted=quoted+LENGTH(currentline)
  49.   ELSE new=new+LENGTH(currentline)
  50.   currentline=READLN('infile')
  51. END
  52. CALL CLOSE('infile')
  53. proc=TRUNC((quoted/(new+quoted))*10000)/100
  54.  
  55.  
  56. /* Put up requester */
  57. reply=name 'quoted 'proc'%%'
  58.  
  59. CALL rtezrequest(reply,,'QuotePercent',,'rt_pubscreenname=SPOT')
  60.  
  61.  
  62. /* Cleanup */
  63. CALL DELETE('t:Spot_1.tmp')
  64.  
  65. quit:
  66. 'unlockgui'
  67. EXIT
  68.