home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / comm / mail / thor / thor.lha / rexx / CrossPost.thor < prev    next >
Text File  |  1994-08-06  |  3KB  |  95 lines

  1. /* CrossPost.thor · by Troels Walsted Hansen
  2. ** $VER: CrossPost.thor v1.13 (19.03.94)
  3. **
  4. ** An ARexx script that will allow you to post one message on
  5. ** infinitely many BBSs, in different conferences if you wish.
  6. */
  7.  
  8. options results
  9.  
  10. if(substr(address(),1,4) ~= "THOR") then do
  11.     parse arg portname
  12.     if~(show(p, portname)) then do
  13.         if ~(show(p, "THOR.01")) then do
  14.             say "No THOR port found!"
  15.             exit
  16.         end
  17.         else portname = "THOR.01"
  18.     end
  19. end
  20. else portname = address()
  21.  
  22. address(portname)
  23.  
  24. /* main stuff */
  25.  
  26. THORTOFRONT
  27. GETGLOBALCONFIG
  28. REQUESTFILE TITLE '"Select message file to crosspost:"' ID '"'GLOBALCONFIG.SAVEDIR'"' FP PAT '"#?"'
  29.  
  30. msgtopost = result
  31. lastchar = right(msgtopost,1)
  32.  
  33. if(rc~=0|lastchar = "/"|lastchar = ":"|msgtopost = "") then do
  34.     REQUESTNOTIFY TEXT '"No file selected!"' BT '"_Ok"'
  35.     exit
  36. end
  37.  
  38. posi = lastpos("/",msgtopost)
  39. if(posi = 0) then posi = lastpos(":",msgtopost)
  40. WithoutPath = substr(msgtopost,posi+1)
  41.  
  42. REQUESTSTRING TITLE '"Please enter subject of message:"' BT '"_Ok|_Cancel"' ID '"'WithoutPath'"' MAXCHARS 40
  43. subject = result
  44. if(rc ~= 0|subject = "") then exit
  45.  
  46. REQUESTSTRING TITLE '"Please enter receiver name:"' BT '"_Ok|_Cancel"' ID '"ALL"' MAXCHARS 40
  47. receiver = result
  48. if(rc ~= 0|receiver = "") then exit
  49.  
  50. REQUESTNOTIFY TEXT '"Do you wish to crosspost to BBSs from a list?"' BT '"_Yes|_No"'
  51.  
  52. if(result = 0) then do
  53.     do forever
  54.         REQUESTLIST BBSLIST
  55.         bbsname = result
  56.         if(rc ~= 0|bbsname = "") then break
  57.  
  58.         REQUESTLIST CONFLIST BBS '"'bbsname'"'
  59.         confname = result
  60.         if(rc ~= 0) then break
  61.  
  62.         ADDEVENT BBS '"'bbsname'"' EVENT ENTERMSG SENDTO '"'receiver'"' CONF '"'confname'"' MSGFILE '"'msgtopost'"' SUB '"'subject'"'
  63.         if(rc ~= 0) then REQUESTNOTIFY TEXT '"Failed to post this time, try again?"' BT '"_Yes|_No"'
  64.         if(result = 0) then break
  65.  
  66.         PACKEVENTS '"'bbsname'"'
  67.     end
  68. end
  69.  
  70. else if(result = 1) then do
  71.     REQUESTFILE TITLE '"Select CrossPost mailing list:"' ID '"THOR:Rexx/PostingLists"' FP
  72.     configfile = result
  73.  
  74.     lastchar = right(configfile,1)
  75.     if(rc~=0|lastchar = "/"|lastchar = ":"|configfile = "") then exit
  76.  
  77.     open(cf, configfile, R)
  78.  
  79.     do forever
  80.         call readln(cf)
  81.         bbsname = substr(readln(cf),6)
  82.         confname = substr(readln(cf),7)
  83.  
  84.         if(bbsname = ""|confname = "") then break
  85.  
  86.         ADDEVENT BBS '"'bbsname'"' EVENT ENTERMSG SENDTO '"'receiver'"' CONF '"'confname'"' MSGFILE '"'msgtopost'"' SUB '"'subject'"'
  87.         if(rc ~= 0) then REQUESTNOTIFY TEXT '"'||'Failed to post at: '||bbsname'"' BT '"_Ok"'
  88.         else PACKEVENTS '"'bbsname'"'
  89.     end
  90.  
  91.     close(cf)
  92. end
  93.  
  94. exit
  95.