home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / comm / Fido / Spot / Rexx / PollWhen.spot < prev    next >
Text File  |  1993-09-07  |  3KB  |  103 lines

  1. /***************************************************************************/
  2. /* PollWhen.spot   ©1993 Stu Churchill   2:250/107.97@fidonet              */
  3. /*                                                                         */
  4. /* $VER: PollWhen.spot 1.53 (7.9.93)                                       */
  5. /*                                                                         */
  6. /* This script, through the use of Spot's requesters, will add a once-only */
  7. /* poll event to your current cron eventlist. This is useful if you want   */
  8. /* to send crash mail during ZMH, or want to f'req a file in the early     */
  9. /* hours of the morning, when the lines should be quieter                  */
  10. /***************************************************************************/
  11.  
  12. options results
  13.  
  14. /***************************************************************************/
  15. /* Set up any variables we may need for later use                          */
  16. /***************************************************************************/
  17.  
  18. NL          = '0d'x
  19. out_dir     = 'MAIL:Outbound'
  20. cron_port   = 'CYBERCRON'
  21. mailer_path = 'D:TrapDoor'
  22. header      = NL||'PollWhen 1.53   © Stu Churchill 1993'||NL||NL
  23.  
  24. /***************************************************************************/
  25. /* First we make sure that we can access the libraries we need             */
  26. /***************************************************************************/
  27.  
  28. if ~show(l, 'rexxsupport.library') then do
  29.   if ~addlib('rexxsupport.library', 0, -30) then do
  30.     say 'Please install the rexxsupport.library in your libs: directory'
  31.   end
  32. end
  33.  
  34. /***************************************************************************/
  35. /* Now we can get on with the rest of the script                           */
  36. /***************************************************************************/
  37.  
  38. address 'SPOT'
  39.  
  40. 'requestfile TITLE "Select a node to dial" PATH "'out_dir'"'
  41. if rc > 0 then do
  42.   exit
  43. end
  44. node = RESULT
  45. if node == '' then exit
  46. type = right(node,3)
  47. if type = CLO | type = REQ | type = FLO | type = OUT | type = CUT then do
  48.   node = buildaddress(node)
  49. end
  50. else do
  51.   'requestnotify PROMPT "       You may only select a  #?.FLO'||NL||'#?.CLO,  #?.REQ,  #?.OUT or  #?.CUT file"'
  52.   exit
  53. end
  54.  
  55. 'requestnumber PROMPT "At which hour of the day'||NL||'should I poll this node?" DEFAULT "2"'
  56. if rc > 0 then do
  57.   exit
  58. end
  59. hour = RESULT
  60. if hour == '' | hour = 'RESULT' then do
  61.   exit
  62. end
  63.  
  64. 'requestnumber PROMPT "And at which minute'||NL||'past the hour?" DEFAULT "45"'
  65. if rc > 0 then do
  66.   exit
  67. end
  68. min = RESULT
  69. if min == '' | min = 'RESULT' then do
  70.   exit
  71. end
  72.  
  73. if ~show('ports',cron_port) then do
  74.   'requestnotify PROMPT "              ** WARNING **'||NL||'Unable to locate ARexx port: '||cron_port'"'
  75.   exit
  76. end
  77.  
  78. address value cron_port
  79. add_event min' 'hour' * * * :EXECONCE :OBEYQUEUE a 'mailer_path' Call 'node' Password ""'
  80.  
  81. address 'SPOT'
  82. 'requestnotify PROMPT "'header'The following event has been added to CyberCron''s eventlist;'||NL||NL||min' 'hour' ** ** ** :EXECONCE :OBEYQUEUE a 'mailer_path' Call 'node' Password ""'
  83.  
  84. exit
  85.  
  86.  
  87. buildaddress: procedure
  88.   parse arg path
  89.   colon = lastpos('/', path)
  90.   if colon = 0 then do
  91.     colon = lastpos(':', path)
  92.   end
  93.   if colon = 0 then do
  94.     file = path
  95.   end
  96.   else do
  97.     file = (substr(path, colon + 1))
  98.   end
  99.   parse var file zone '.' net '.' node '.' point '.' type
  100.   if point ~= 0 then point = 0
  101.   node = zone':'net'/'node'.'point
  102.   return node
  103.