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

  1. /* SaveRange.thor · by Troels Walsted Hansen
  2. ** $VER: SaveRange.thor v1.30 (19.05.94)
  3. **
  4. ** Save a specified range of messages to disk.
  5. **
  6. ** New features: · "/" and ":" characters in confnames
  7. **                 no longer causes trouble
  8. **               · won't ask for bbs and conf if a
  9. **                 bbs is open and a conf is active
  10. */
  11.  
  12. options results
  13.  
  14. if(substr(address(),1,4) ~= "THOR") then do
  15.     parse arg portname
  16.     if~(show(p, portname)) then do
  17.         if ~(show(p, "THOR.01")) then do
  18.             say "No THOR port found!"
  19.             exit
  20.         end
  21.         else portname = "THOR.01"
  22.     end
  23. end
  24. else portname = address()
  25.  
  26. address(portname)
  27.  
  28. GETGLOBALCONFIG
  29. CURRENTBBS stem CURRENT
  30.  
  31. if(CURRENT.BBSNAME ~= "" & CURRENT.CONFNAME ~= "") then do
  32.     bbsname = CURRENT.BBSNAME
  33.     confname = CURRENT.CONFNAME
  34. end
  35. else do
  36.     REQUESTLIST BBSLIST
  37.     bbsname = result
  38.     if(rc ~= 0) then exit
  39.  
  40.     REQUESTLIST CONFLIST BBS '"'bbsname'"'
  41.     confname = result
  42.     if(rc ~= 0) then exit
  43. end
  44.  
  45. GETCONFCONFIG bbs '"'bbsname'"' conf '"'confname'"' stem CONFIG
  46.  
  47. REQUESTINTEGER MIN '"'CONFIG.FIRSTMSG'"' MAX '"'CONFIG.LASTMSG'"' INIT '"'CONFIG.FIRSTMSG'"' TITLE '"First message in range:"' BT '"_Ok|_Cancel"'
  48. firstmsg = result
  49. if(rc ~= 0 | firstmsg = "RESULT") then exit
  50.  
  51. REQUESTINTEGER MIN '"'firstmsg'"' MAX '"'CONFIG.LASTMSG'"' INIT '"'CONFIG.LASTMSG'"' TITLE '"Last message in range:"' BT '"_Ok|_Cancel"'
  52. lastmsg = result
  53. if(rc ~= 0 | lastmsg = "RESULT") then exit
  54.  
  55. REQUESTFILE TITLE '"Select directory for messages:"' ID '"'GLOBALCONFIG.SAVEDIR'"' FP PAT '"#?"'
  56. if(rc ~= 0|result = "") then exit
  57. else dir = result
  58.  
  59. /* if user selected a file instead (silly user) reduce it to dirname */
  60.  
  61. endchar = right(dir,1)
  62.  
  63. if(endchar ~= ":" & endchar ~= "/") then do
  64.     posi = lastpos("/",dir)
  65.     if(posi = 0) then posi = lastpos(":",dir)
  66.     dir = delstr(dir,posi+1)
  67. end
  68.  
  69. if(pos("/",confname) ~= 0 | pos(":",confname) ~= 0) then
  70.     newconfname = translate(confname,"..","/:")
  71. else newconfname = confname
  72.  
  73. do i=firstmsg to lastmsg
  74.     SAVEMESSAGE BBS '"'bbsname'"' CONF '"'confname'"' MSGNR i FILENAME '"'||dir||newconfname||'.'||i||'"'
  75. end
  76.  
  77. exit
  78.