home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / tagbet.zip / DOWNMULT.CMD < prev    next >
OS/2 REXX Batch file  |  1995-03-09  |  4KB  |  118 lines

  1. /*Example DOWNMULT.CMD that generates and sends additionally a LogFile of the
  2.   transferred files.
  3. */
  4.  
  5. arg prot com node filelist
  6.  
  7. descfilepath=directory()
  8. dateformat="E"   /*European, use "U" for US format*/
  9. BBSName="MY BBS" /*Put the Name of your BBS in these Quotes*/
  10. usedescriptionfile=1 /*set this to 0 if you do not want a descriptionfile*/
  11.  
  12. logoff=0
  13. if prot="L" then do
  14.   logoff=1
  15.   prot="Z"
  16. end
  17.  
  18. dlbbs="dl"node".bbs"
  19. "@if exist "dlbbs" del "dlbbs
  20. rc=lineout(dlbbs," ")                       /*[moreoff]          */
  21. rc=lineout(dlbbs,"P"prot)                  /*[key_poke]prot     */
  22. rc=lineout(dlbbs,"rj")                    /*[chg_protocoll]*/
  23. rc=lineout(dlbbs,"ü******************************************************")
  24. rc=lineout(dlbbs,"ÄPlease hold on, initiating Download ..................")
  25. rc=lineout(dlbbs,"ü******************************************************")
  26. line=linein(filelist)
  27. fcount=0
  28. do while line<>""
  29.   fcount=fcount+1
  30.   if fcount>25 then do  /*repeat download command*/
  31.     rc=lineout(dlbbs,"P|")                     /*[key_poke]|        */
  32.     rc=lineout(dlbbs,"r∙")                    /*[menu_cmd download]*/
  33.  
  34.     fcount=1
  35.   end
  36.   fname=word(line,1)
  37.   rc=lineout(dlbbs,"J"fname"%")            /*[download]filename%*/
  38.   line=linein(filelist)
  39. end
  40. rc=lineout(filelist)
  41.  
  42. if (prot="Z") & (usedescriptionfile=1) then rc=lineout(dlbbs,"J"descname()"%")
  43.  
  44. if logoff=1 then rc=lineout(dlbbs,"P/G")   /*[key_poke]/G       */
  45. rc=lineout(dlbbs,"P|")                     /*[key_poke]|        */
  46. rc=lineout(dlbbs,"r∙")                    /*[menu_cmd download]*/
  47. rc=lineout(dlbbs,"")                       /*[enter]            */
  48. rc=lineout(dlbbs)
  49. exit
  50.  
  51.  /**************************************************/
  52.  /*            create Description-Files            */
  53.  /**************************************************/
  54.  
  55. descname:
  56. call RxFuncAdd "SysFileTree", "RexxUtil", "SysFileTree"
  57.  
  58.   /*Get Last Name, count number up*/
  59.  
  60. call sysfiletree descfilepath"\OF"node"*.LOG", "flist", "FO"
  61. if flist.0>0 then do
  62.   olddesc=right(flist.1,12)
  63. "del "flist.1
  64.   oldnum=substr(olddesc,5,4)
  65.   thedesc=descfilepath"\OF"node""right(oldnum+1,4,'0')".LOG"
  66. end
  67. else thedesc=descfilepath"\OF"node"0000.LOG"
  68.  
  69.    /*generate file */
  70.  
  71. namewid=13
  72. sizewid=6
  73. datewid=10
  74. linewid=75
  75. leftwid=namewid+sizewid+datewid
  76. descwid=linewid-leftwid
  77.  
  78. rc=lineout(thedesc,BBSName" Download-Log of: "date(dateformat)"  "time())
  79. rc=lineout(thedesc,"Name          Size  Upload   Description")
  80. rc=lineout(thedesc,"------------------------------------------------------------------------------")
  81. filenum=0
  82. line=linein(filelist)
  83. do while line<>""
  84.   fname=word(line,1)
  85.     name=left(filespec("name",fname),namewid)
  86.     size=format(word(line,2) / 1024,sizewid-1,0)"k"
  87.     date=" "left(word(line,3),datewid-1)
  88.     linedesc=delword(line,1,3)
  89.     if substr(linedesc,1,1)="[" then  /*remove Dl-Counter (one word)*/
  90.       linedesc=delword(linedesc,1,1)
  91.     first=1
  92.     do while first=1 | word(linedesc,1)<>"" /*do once for each wrapped line*/
  93.       if first then do
  94.         first=0
  95.         leftspace=name""size""date""
  96.       end
  97.       else leftspace=left("",leftwid)
  98.       i=0
  99.       do while length(subword(linedesc,1,i+1))<descwid & word(linedesc,i+1)<>""
  100.         i=i+1 /*count max words to fill one line*/
  101.       end
  102.       if i=0 then do /*cut word if too long*/
  103.         thisline=substr(linedesc,1,descwid)
  104.         linedesc=substr(linedesc,descwid+1,length(linedesc)-descwid)
  105.       end
  106.       else do
  107.         thisline=subword(linedesc,1,i)
  108.         linedesc=delword(linedesc,1,i)
  109.       end
  110.       rc=lineout(thedesc,leftspace""thisline)
  111.     end
  112.   line=linein(filelist)
  113. end
  114. rc=lineout(filelist)
  115. rc=lineout(thedesc)
  116.  
  117. return thedesc /*return name*/
  118.