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

  1. /* UUDecode.thor · by Troels Walsted Hansen
  2. ** $VER: UUDecode.thor v1.31 (19.03.94)
  3. **
  4. ** An ARexx script that uudecodes the file(s) contained in the
  5. ** message currently displayed in Thor. Utilises uuOut by Nicolas
  6. ** Dade.
  7. **
  8. ** Known to work with uuOut v1.03.
  9. */
  10.  
  11. /* some user varibles. edit to your hearts content */
  12.  
  13. tmpdir = "T:"              /* Work dir for the decoding      */
  14.  
  15. /* this is where the action begins.. */
  16.  
  17. options results
  18.  
  19. if(substr(address(),1,4) ~= "THOR") then do
  20.     parse arg portname
  21.     if~(show(p, portname)) then do
  22.         if ~(show(p, "THOR.01")) then do
  23.             say "No THOR port found!"
  24.             exit
  25.         end
  26.         else portname = "THOR.01"
  27.     end
  28. end
  29. else portname = address()
  30.  
  31. address(portname)
  32.  
  33. if ~show(l, 'rexxsupport.library') then do
  34.     if ~addlib('rexxsupport.library', 0, -30) then do
  35.         say "Please install rexxsupport.library in your libs: directory"
  36.         exit
  37.     end
  38. end
  39.  
  40. /* main stuff */
  41.  
  42. GETGLOBALCONFIG
  43. SAVEMESSAGE CURRENT FILENAME tmpdir"Message.uu"
  44.  
  45. if ~exists(tmpdir"Message.uu") then do
  46.     REQUESTNOTIFY TEXT '"Message containing uuencoded file not saved correctly."' BT '"_Ok"'
  47.     exit
  48. end
  49.  
  50. address command "uuOut >"||tmpdir||"UUError "||tmpdir||"Message.uu OUTPATH="||GLOBALCONFIG.DOWNLOADPATH||" USEBASENAME"
  51. address(portname)
  52.  
  53. open(errfile, tmpdir"UUError", R)
  54.     str = readln(errfile)
  55. close(errfile)
  56.  
  57. if(pos("uuOut: WARNING, EOF was reached without ever finding a 'begin' line!", str) ~= 0) then
  58.     REQUESTNOTIFY TEXT '"Message does not contain uuencoded data."' BT '"_Ok"'
  59.  
  60. /* cleanup and exit */
  61.  
  62. call delete(tmpdir"UUError")
  63. call delete(tmpdir"Message.uu")
  64. exit
  65.