home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / gpm108b.zip / Utils / CALLERID.CMD < prev    next >
OS/2 REXX Batch file  |  1998-09-23  |  2KB  |  91 lines

  1. /* CallerID.log for GPMailer */
  2.  
  3. '@echo off'
  4.  
  5. GPMlog='\fido\logs\GPMail.Log' /* ï«ú ¼Ñ⌐½Ñαá */
  6. CIDlog='\fido\logs\CallerID.Log' /* ï«ú óσ«ñ∩Θ¿σ ºó«¡¬«ó */
  7.  
  8. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil',  'SysLoadFuncs'
  9. call SysLoadFuncs
  10.  
  11. call stream GPMlog,'c','open read'
  12. call stream CIDlog,'c','open write'
  13.  
  14. call lineout CIDlog, 'CallerID.log started on' Date(European) 'at' Time()
  15. call lineout CIDlog, '----------------------------------------------------------------------------'
  16.  
  17. subdate = substr(Date(European),4,2)
  18. day = substr(Date(European),1,2)
  19.  
  20. Select
  21.    when subdate = 01 then date = day 'Jan'
  22.    when subdate = 02 then date = day 'Feb'
  23.    when subdate = 03 then date = day 'Mar'
  24.    when subdate = 04 then date = day 'Apr'
  25.    when subdate = 05 then date = day 'May'
  26.    when subdate = 06 then date = day 'Jun'
  27.    when subdate = 07 then date = day 'Jul'
  28.    when subdate = 08 then date = day 'Aug'
  29.    when subdate = 09 then date = day 'Sep'
  30.    when subdate = 10 then date = day 'Oct'
  31.    when subdate = 11 then date = day 'Nov'
  32.    when subdate = 12 then date = day 'Dec'
  33.    otherwise do
  34.       say 'Strange date. Unable to continue.'
  35.       call lineout CIDlog, 'Strange date. Unable to continue.'
  36.       signal Done
  37.    end
  38. end
  39.  
  40. activity = 0
  41. incalls = 0
  42. q = 0
  43.  
  44. do until lines(GPMlog)=0
  45.    var=linein(GPMlog)
  46.    if substr(var,3,6)=date then do
  47.       activity = 1
  48.          if substr(var,24,23) = 'Ring #1 detected [RING]' then q = 2
  49.          if substr(var,24,14) = 'Incoming call:' then q = 1
  50.          if substr(var,24,4) = '+FCO' then q = 1
  51.          if substr(var,24,16) = "Caller's Number:" then q = 1
  52.          if q = 2 then do
  53.             say ''
  54.             call lineout CIDlog, ''
  55.             q = 1
  56.          end
  57.          if q = 1 then do
  58.             CID = substr(var,3,15) substr(var,24,50)
  59.             say CID
  60.             call lineout CIDlog, CID
  61.             incalls = 1
  62.          end
  63.          q = 0
  64.    end
  65. end
  66.  
  67. if activity = 0 then do
  68.    CID = 'No activity today.'
  69.    say CID
  70.    call lineout CIDlog, CID
  71. end
  72.  
  73. if activity = 1 & incalls = 0 then do
  74.    CID = 'No incoming calls today.'
  75.    say CID
  76.    call lineout CIDlog, CID
  77. end
  78.  
  79. Done:
  80.  
  81. call lineout CIDlog, '----------------------------------------------------------------------------'
  82. call lineout CIDlog, ''
  83.  
  84. call stream GPMlog,'c','close'
  85. call stream CIDlog,'c','close'
  86.  
  87. Say ''
  88. Say 'Press a key to exit...'
  89. Call SysGetKey(Noecho)
  90.  
  91. exit