home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / comm / spot-1.3.lha / Spot / Rexx / AutoPoll.spot < prev    next >
Text File  |  1994-07-24  |  3KB  |  99 lines

  1. /****************************************************** *********************/
  2. /* AutoPoll.spot      ©1994 Gert Lindstrom  2:201/411.47@fidonet           */
  3. /*                                                                         */
  4. /* $VER: AutoPoll.spot 1.1 (07-Jul-94)                                     */
  5. /*                                                                         */
  6. /* This script goes thru your OUTBOUND library and checks if there are any */
  7. /* files to addresses not assigned to the variable NET. Then it asks if    */
  8. /* you likes to poll those addresses before it puts up the poll requester. */
  9. /* Very handy when you send crashmail or do some filerequesting, you dont  */
  10. /* have to remember to poll manuelly.                                      */
  11. /* Rename it to _poll.spot to have work autmatically                       */
  12. /*                                                                         */
  13. /* v1.1  Now also parses out the point.                                    */
  14. /*       Only tries to call addresses with extensions assigned to EXTLIST  */
  15. /*                                                                         */
  16. /***************************************************************************/
  17.  
  18.  
  19. /*******************************************/
  20. /*  Assign all your NET's to this variable */
  21. /*******************************************/
  22. NETLIST = '11:100/1.0 92:901/231.0 69:4606/120.0 39:164/100.0 23:100/110.0
  23.            2:201/411.0 2:201/417.0'
  24.  
  25. EXTLIST = 'CUT REQ'
  26.  
  27. if ~show(L, 'rexxsupport.library') then do
  28.     call AddLib('rexxsupport.library',0,-30,0)
  29.     end
  30.  
  31. address SPOT
  32. options results
  33. signal on syntax
  34. LF      = '0d'x
  35. TEXT.1  = 'You have some CRASH mail to send to node'
  36. TEXT.2  = 'You have some files to get from node'
  37. PATH    = 'MAIL:OUTBOUND/'
  38.  
  39. ANTNET = words(NETLIST)
  40. do COUNT = 1 while NETLIST ~= ''
  41.     parse var NETLIST NET.COUNT NETLIST
  42.     end
  43.  
  44. ANTEXT = words(EXTLIST)
  45. do COUNT = 1 while EXTLIST ~= ''
  46.     parse var EXTLIST EXT.COUNT EXTLIST
  47.     end
  48.  
  49. FILELIST = showdir(PATH, 'f')
  50. do while FILELIST ~= ''
  51.     parse var FILELIST FILE FILELIST
  52.         if ExtCheck(FILE) ~= ANTEXT then do
  53.             if NetCheck(FILE) = ANTNET then do
  54.                 if right(FILE,3) = 'CUT' then TEXT = TEXT.1
  55.                 if right(FILE,3) = 'REQ' then TEXT = TEXT.2
  56.                 address SPOT
  57.                 'requestresponse TITLE "AutoPoll" PROMPT "'TEXT LF ParseAdr(FILE)'" GADGETS "_Poll|_Delete|_Cancel" CENTER'
  58.                 if RC = 1 then do
  59.                     address command
  60.                     'trapdoor call' ParseAdr(FILE)
  61.                      end
  62.                 if RC = 2 then do
  63.                     address command
  64.                     'delete >NIL:' PATH||FILE
  65.                     end
  66.                 end
  67.              end
  68.         end
  69. signal exit
  70.  
  71. NetCheck: Procedure expose ANTNET NET.
  72.     TMP = arg(1)
  73.     CHECK = 0
  74.     do COUNT = 1 to ANTNET
  75.         if ParseAdr(TMP) ~= NET.COUNT then CHECK = CHECK + 1
  76.         end
  77.     return CHECK
  78.  
  79. ParseAdr: Procedure
  80.     parse arg ZON'.'NET'.'NODE'.'POINT'.' .
  81.     return ZON':'NET'/'NODE'.'POINT
  82.  
  83. ExtCheck: Procedure expose ANTEXT EXT.
  84.     TMP = arg(1)
  85.     TMP = right(TMP,3)
  86.     CHECK = 0
  87.     do COUNT = 1 to ANTEXT
  88.         if TMP ~= EXT.COUNT then CHECK = CHECK + 1
  89.         end
  90.     return CHECK
  91.  
  92. syntax:
  93. say rc errortext(rc) 'in line' SIGL
  94.  
  95. exit:
  96. address SPOT
  97. 'poll'
  98. EXIT
  99.