home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lorautil.zip / DOORTRAK.CMD < prev    next >
OS/2 REXX Batch file  |  1995-05-08  |  7KB  |  250 lines

  1. /* Door Tracking REXX cmd file by Elliott Goodman
  2. Version 1.42, 20 Apr, 1995. 1:102/1319
  3.  
  4. Modify as needed. Please note: you may have to adjust
  5. the directories you are in when calling this. It's set up
  6. for my system (of course).
  7.  
  8. Donations for this program may be sent to:
  9.  
  10.      Elliott Goodman        
  11.      PO Box 500038          
  12.      Palmdale, CA 93591-0038
  13.  
  14. */
  15.  
  16. /* trace ?a */
  17.  
  18. phrase = 'External'        /* Specific phrases to look for */
  19. phrase1 = 'off-line.'
  20. phrase2 = 'Returned'
  21. phrase3 ='D:\LORA\LORD1.BAT'
  22. phrase4 ='D:\LORA\PLANET1.BAT'
  23. phrase5 ='D:\LORA\DOORS\EZELS.BAT'
  24. phrase6 = 'Write'
  25. phrase7 = 'Connect FAX'
  26. phrase8 = 'Calls=1,'
  27. phrase9 = 'System call'
  28. phrase10 = 'Receiving'
  29. phrase11 = 'packet(s):'
  30. phrase12 = 'D:\LORA\DOORS\EZVOTE\EZVOTE.BAT'
  31. phrase13 = 'D:\LORA\DOORS\SPIKE\SPIKE.BAT'
  32.  
  33. count = 0    /* initialize counters */
  34. caller_count = 0
  35. lord = 0
  36. planet = 0
  37. ezels = 0
  38. ezvote = 0
  39. spike = 0
  40. ice = 0
  41. fax_count = 0
  42. Sys_Txt = ' No System Calls??'
  43. BBS_calls = 0
  44. user_names = 0
  45. temp_name = ' '
  46. temp_count = 0
  47. total_count = 0
  48. echomail = 0
  49.  
  50. drop callers.
  51.  
  52. max_time = (24 * 3600)    /* 24:00 if someone should span the day */
  53. total_time = 0            /* total time in doors */
  54. total_hours = 0
  55. total_minutes = 0
  56. total_seconds = 0
  57.  
  58. say "Door Trakker by Elliott Goodman"
  59. say "Version 1.42, April 20, 1995"
  60. say ''
  61.  
  62. in_name = 'lora.log'            /* filename to search */
  63.  
  64. do until lines(in_name) = 0             /* read in each line */
  65.   work_line = linein(in_name)           /* current line to examine */
  66.   j = wordpos(phrase, work_line)      /* look for the phrase */
  67.   if j \= 0 then do                     /* phrase found */
  68.       next_line = linein(in_name)    /* get next line */
  69.       k = wordpos(phrase2, next_line)
  70.       if k \= 0 then do
  71.  
  72. /* Okay, work_line has 'External' in it and next_line has 'Returned' in it.
  73. Therefore, a user has gone to a door and returned. Now, let's parse the lines */
  74.  
  75.         count = count + 1        /* increment count */
  76. /* find out which door was run */
  77.  
  78.     n = wordpos(phrase3, work_line)    /* Test for Legend */
  79.       if n \= 0 then do
  80.         lord = lord + 1
  81.         end
  82.     n = wordpos(phrase4, work_line)    /* Test for Planets */
  83.       if n \= 0 then do
  84.         planet = planet + 1
  85.         end
  86.     n = wordpos(phrase5, work_line)    /* Test for EZ-Els */
  87.       if n \= 0 then do
  88.         ezels = ezels + 1
  89.         end
  90.  
  91.         n = wordpos(phrase12, work_line)   /* Test for EZ-Vote */
  92.           if n \= 0 then do
  93.             ezvote = ezvote + 1
  94.             end
  95.  
  96.         n = wordpos(phrase13, work_line)  /* test for Spiked! */
  97.           if n \= 0 then do
  98.             spike = spike + 1
  99.             end
  100.  
  101. /* these lines get the time the event occurred */
  102.         parse var work_line ':' start_time junk
  103.         parse var next_line ':' end_time junk
  104.  
  105. /* these lines parse the time into hours/minutes/seconds */
  106.         parse var start_time shour ':' smin ':' ssec
  107.         parse var end_time ehour ':' emin ':' esec
  108.  
  109. /* calculate total seconds */
  110.         stotal = (3600 * shour) + (60 * smin) + ssec
  111.         etotal = (3600 * ehour) + (60 * emin) + esec
  112.  
  113. /* if start time > end time, user has spanned midnight - adjust */
  114.         if stotal > etotal then
  115.           this_time = (max_time - stotal) + etotal
  116.         else
  117.           this_time = etotal - stotal
  118.  
  119.         total_time = total_time + this_time
  120.  
  121.         end /* k \= */
  122.       k = wordpos(phrase6, next_line)
  123.       if k \= 0 then do
  124.         ice = ice + 1
  125.         count = count + 1
  126.       end /* if k \=0 */
  127.  
  128.     end       /* end if j \= */
  129.  
  130.     else do /* 'external' NOT found. Test for these phrases */
  131.  
  132.       j = wordpos(phrase7, work_line) /* 'connect FAX' */
  133.       if j \= 0 then
  134.       do
  135.         fax_count = fax_count + 1
  136.         end /* if j \= 0 */
  137.  
  138.       j = wordpos(phrase8, work_line) /* new caller */
  139.       if j \= 0 then
  140.       do
  141.            parse upper var work_line . . first_name last_name 'OFF-LINE.' dummy
  142.            say "New caller: "first_name last_name
  143.            end /* j \= 0 */
  144.  
  145.        j = wordpos(phrase9, work_line) /* BBS call - increment count */
  146.        if j \= 0 then
  147.        do
  148.            parse var work_line . . Sys_Txt
  149.            BBS_calls = BBS_calls + 1
  150.            end
  151.  
  152.         j = wordpos(phrase10, work_line) /* file RECEIVED! */
  153.         if j \= 0 then
  154.         do
  155.             parse var work_line . . to_where dummy
  156.             select
  157.                when left(to_where, 13) = 'FILE\UNCHECK\' then
  158.                   say 'File Uploaded:' to_where
  159.                otherwise
  160.                   iterate
  161.                end
  162.             end
  163.  
  164.     j = wordpos(phrase11, work_line) /* track echo messages */
  165.     if j \= 0 then
  166.       do
  167.          parse var work_line . . . . . . e_temp dummy
  168.          echomail = echomail + e_temp
  169.          end
  170.  
  171.     j = wordpos(phrase1, work_line) /* track caller names */
  172.     if j \= 0 then do
  173.         parse var work_line . . first last (phrase1) stuff
  174.         caller_tag = first last
  175.         found = 0
  176.         do index = 1 to user_names
  177.            if callers.index = caller_tag then do
  178.               callers.index.caller_count = callers.index.caller_count + 1
  179.               found = 1
  180.               leave
  181.               end /* if */
  182.            end /* do index = 1 to user_names */
  183.         if found = 0 then do
  184.            user_names = user_names + 1
  185.            callers.user_names = caller_tag
  186.            callers.user_names.caller_count = 1
  187.            end /* if found = 0 */
  188.         end /* if j \= */
  189.     end  /* else do */
  190. end             /* do until */
  191.  
  192. call lineout in_name       /* close file */
  193.  
  194. say "BBS Calls:" BBS_calls || ", High" || Sys_Txt
  195. say " "
  196.  
  197. /* calculate hours and minutes */
  198. if total_time > 3600 then do
  199.   total_hours = total_time % 3600
  200.   total_time = total_time // 3600
  201.   end
  202.  
  203. if total_time > 60 then do
  204.   total_minutes = total_time % 60
  205.   total_time = total_time // 60
  206.   end
  207.  
  208. total_seconds = total_time
  209.  
  210. /* adjust total to EXCLUDE Ice Edit messages */
  211. count = count - ice
  212.  
  213. say "Times in doors today:" count || ", Echomail:" echomail
  214. say "LORD =" lord "Planets =" planet "EZ-Echo Searcher =" ezels "EZ-Vote =" ezvote "Spiked! =" spike
  215. say "Hours:" total_hours||", Minutes:" total_minutes
  216. if ice = 1 then
  217.    say "Ice Edit wrote" ice "message."
  218. else
  219.    say "Ice Edit wrote" ice "messages."
  220. /* say "Faxes received: " fax_count */
  221. say ''
  222.  
  223. /* sort callers by # of times called today */
  224. swap = 1
  225. do until swap = 0
  226.     swap = 0
  227.     do index = 1 to user_names -1
  228.         t_index = index + 1
  229.         if callers.t_index.caller_count > callers.index.caller_count then do
  230.             temp_name = callers.index
  231.             temp_count = callers.index.caller_count
  232.             callers.index = callers.t_index
  233.             callers.index.caller_count = callers.t_index.caller_count
  234.             callers.t_index = temp_name
  235.             callers.t_index.caller_count = temp_count
  236.             swap = 1
  237.             end /* if */
  238.         end /* do */
  239.     end /* do until */
  240.  
  241. do index = 1 to user_names
  242.    m_txt = callers.index.caller_count '-' callers.index
  243.    say m_txt
  244.    end
  245. say 'Press any key to exit....' 
  246.  
  247. parse pull stuff
  248.  
  249. exit
  250.