home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / adcal080.zip / callers.cmd < prev    next >
OS/2 REXX Batch file  |  1995-08-11  |  7KB  |  198 lines

  1. /* Rexx Script to read in recent callers lists Generated by AdeptXBBSCaller
  2.    by Robert Stephens, it converts Meta codes to Ansi Escape sequences on
  3.    the fly.
  4.  
  5.    This Script is designed for the Sysop to view the recent callers lists
  6.    from the OS/2 command prompt, place this file in a directory that is in
  7.    your search path so it can be accessed from any directory.
  8.                                                                              */
  9. '@Cls'
  10.  
  11. Call RxFuncAdd 'SysGetKey', 'RexxUtil', 'SysGetKey'
  12.  
  13. Adept_Drive_Letter = VALUE('APATH',,'OS2ENVIRONMENT')
  14. If Adept_Drive_Letter = "" Then Do
  15.    Say "Sysop Warning!:"
  16.    Say "The 'APATH' environment variable isn't set, AdeptXBBSCaller will"
  17.    Say "not operate correctly without it."
  18.    Say "Hit any Key to Exit"
  19.    Dummy = SysGetKey('NOECHO')
  20.    Say ""
  21.    Exit
  22. End
  23. Parse VAR Adept_Drive_Letter Drive_Letter ':'
  24. Adept_Drive_Letter = Drive_Letter":"
  25. A1 = Stream(Adept_Drive_Letter"\ADEPT\MENUS\ADCALLER.CFG",'c','Close')
  26. A1 = Stream(Adept_Drive_Letter"\ADEPT\MENUS\ADCALLER.CFG",'c','Open Read')
  27. Text_Path = LineIn(Adept_Drive_Letter'\Adept\Menus\AdCaller.Cfg')
  28. A1 = Stream(Adept_Drive_Letter"\ADEPT\MENUS\ADCALLER.CFG",'c','Close')
  29.  
  30. Show = '0_Days_Old.Asc'  /* Default File to Show First when Callers.Cmd
  31.                             is Executed                              */
  32. Screen_Length = 24       /* Leave it at 24 */
  33. Minute_Tally = 0
  34. Line_Counter = 0
  35. Position = 1
  36. B = Stream(Text_Path''Show,'c','Close')
  37. Prompt1 = Centre("[0] Today's Callers, [1-9] Previous Days, [*] Best Day",79)
  38. Prompt2 = ""Prompt1
  39. Prompt3 = Centre("Enter Selection [0-9], [*] or Hit [=] to Exit:",78)
  40. Prompt4 = ""Prompt3
  41.  
  42. Read_List:
  43. Answer = "-1"
  44. Show = Text_Path''Show
  45. B = Stream(Show,'c','Open Read')
  46. Counter = 0
  47. Do While Lines(Show) = 1
  48.    Say "A"
  49.    Do While Counter < Screen_Length
  50.       InLine = LineIn(Show)
  51.       Analyse = InLine
  52.       Analyse_Pos = Pos(":",Analyse)
  53.       If Analyse_Pos >= 1 Then Do
  54.          Analyse_Pos = Analyse_Pos - 2
  55.          LogOn_Time = SubStr(Analyse,Analyse_Pos,5)
  56.          Analyse_Pos = LastPos(":",Analyse)
  57.          Analyse_Pos = Analyse_Pos - 2
  58.          LogOff_Time = SubStr(Analyse,Analyse_Pos,5)
  59.          Analyse_Pos = 0
  60.          Parse Var LogOff_Time LogOff_Hour ':' LogOff_Minute
  61.          Parse Var LogOn_Time LogOn_Hour ':' LogOn_Minute
  62.          If LogOn_Hour = LogOff_Hour Then Mins = LogOff_Minute - LogOn_Minute
  63.          If LogOn_Hour \= LogOff_Hour Then Do
  64.             Mins = LogOff_Minute
  65.             Hour_Difference = LogOff_Hour - LogOn_Hour
  66.             If Hour_Difference >= 2 Then Mins = Mins + Hour_Difference * 60 - LogOn_Minute
  67.             If Hour_Difference <= 1 Then Do
  68.                Temp_Mins = 60 - LogOn_Minute
  69.                Mins = Mins + Temp_Mins
  70.             End
  71.          End
  72.          Minute_Tally = Minute_Tally + Mins
  73.          Line_Counter = Line_Counter + 1
  74.       End
  75.       Do Until Position = 0
  76.          Position = Pos("{",InLine)
  77.          If Position = 0 Then Leave
  78.          Meta = SubStr(InLine,Position,3)
  79.          IF Meta = "{FG" Then New_Ansi = ""
  80.          IF Meta = "{FC" Then New_Ansi = ""
  81.          IF Meta = "{FB" Then New_Ansi = ""
  82.          IF Meta = "{FF" Then New_Ansi = ""
  83.          IF Meta = "{FD" Then New_Ansi = ""
  84.          IF Meta = "{F1" Then New_Ansi = ""
  85.          IF Meta = "{F5" Then New_Ansi = ""
  86.          IF Meta = "{CS" Then New_Ansi = ""
  87.          Ansi_Length = Length(New_Ansi)
  88.          Remove_Meta = DelStr(InLine,Position,3)
  89.          New_Pos = Position - 1
  90.          Processed_Line = Insert(New_Ansi,Remove_Meta,New_Pos,Ansi_Length)
  91.          InLine = Processed_Line
  92.       End
  93.       If InLine = "" Then Leave
  94.       Counter = Counter + 1
  95.       Say Processed_Line
  96.    End
  97.    If Counter < Screen_Length Then Leave
  98.    Counter = 0
  99.    Temp = CharOut(,"More (Y/n) ?")
  100.    Answer = SysGetKey('NOECHO')
  101.    Temp = CharOut(,"")
  102.    If (Answer = "N") | (Answer = "n") Then Signal View_Prompt
  103. End
  104. B = Stream(Show,'c','Close')
  105. Say ""
  106. If (R1 \= "") Then Do
  107.    Average_Call = Minute_Tally / Line_Counter
  108.    Average_Call = Trunc(Average_Call,1)
  109.    Duration = "Average Call Duration : "Average_Call" Minutes"
  110.    Duration = Centre(Duration,79)
  111.    Duration = ""Duration
  112.    Say Duration
  113. End
  114.  
  115. Say Prompt2
  116.  
  117. View_Prompt:
  118. Minute_Tally = 0
  119. Line_Counter = 0
  120. B = Stream(Show,'c','Close')
  121. Temp = CharOut(,"D")
  122. Temp = CharOut(,Prompt4)
  123.  
  124. Second_Prompt:
  125. Key = SysGetKey('NOECHO')
  126. If Key = 0 Then Do
  127.    Show = '0_Days_Old.Asc'
  128.    Signal Read_List
  129. End
  130. If Key = "=" Then Do
  131.    B = Stream(Show,'c','Close')
  132.    Say ""
  133.    Exit
  134. End
  135. If Key = "" Then Signal View_Prompt
  136. If Key = "*" Then Do
  137.    Show = 'Most_Callers.Asc'
  138.    R1 = Stream(Text_Path''show,'c','query exists')
  139.    IF R1 = "" Then Say "Data File Missing!"
  140.    Signal Read_List
  141. End
  142. If Key = 1 Then Do
  143.    Show = '1_Days_Old.Asc'
  144.    R1 = Stream(Text_Path''show,'c','query exists')
  145.    IF R1 = "" Then Say "Data File Missing!"
  146.    Signal Read_List
  147. End
  148. If Key = 2 Then Do
  149.    Show = '2_Days_Old.Asc'
  150.    R1 = Stream(Text_Path''show,'c','query exists')
  151.    IF R1 = "" Then Say "Data File Missing!"
  152.    Signal Read_List
  153. End
  154. If Key = 3 Then Do
  155.    Show = '3_Days_Old.Asc'
  156.    R1 = Stream(Text_Path''show,'c','query exists')
  157.    IF R1 = "" Then Say "Data File Missing!"
  158.    Signal Read_List
  159. End
  160. If Key = 4 Then Do
  161.    Show = '4_Days_Old.Asc'
  162.    R1 = Stream(Text_Path''show,'c','query exists')
  163.    IF R1 = "" Then Say "Data File Missing!"
  164.    Signal Read_List
  165. End
  166. If Key = 5 Then Do
  167.    Show = '5_Days_Old.Asc'
  168.    R1 = Stream(Text_Path''show,'c','query exists')
  169.    IF R1 = "" Then Say "Data File Missing!"
  170.    Signal Read_List
  171. End
  172. If Key = 6 Then Do
  173.    Show = '6_Days_Old.Asc'
  174.    R1 = Stream(Text_Path''show,'c','query exists')
  175.    IF R1 = "" Then Say "Data File Missing!"
  176.    Signal Read_List
  177. End
  178. If Key = 7 Then Do
  179.    Show = '7_Days_Old.Asc'
  180.    R1 = Stream(Text_Path''show,'c','query exists')
  181.    IF R1 = "" Then Say "Data File Missing!"
  182.    Signal Read_List
  183. End
  184. If Key = 8 Then Do
  185.    Show = '8_Days_Old.Asc'
  186.    R1 = Stream(Text_Path''show,'c','query exists')
  187.    IF R1 = "" Then Say "Data File Missing!"
  188.    Signal Read_List
  189. End
  190. If Key = 9 Then Do
  191.    Show = '9_Days_Old.Asc'
  192.    R1 = Stream(Text_Path''show,'c','query exists')
  193.    IF R1 = "" Then Say "Data File Missing!"
  194.    Signal Read_List
  195. End
  196. IF (Key \= 1) | (Key \= 2) | (Key \= 3) | (Key \= 4) | (Key \= 5) | (Key \= 6) | (Key \= 7) | (Key \= 8) | (Key \= 9) | (Key \= "*") | (Key \= "=") | (Key \= "") Then Signal Second_Prompt
  197. Signal View_Prompt
  198.