home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / tagbet.zip / FILEDESC.ZIP / FILEDESC.CMD next >
OS/2 REXX Batch file  |  1993-07-20  |  2KB  |  68 lines

  1. /* 
  2.  
  3.   This one generates a file announcement out of your tagged files, 
  4.   (preferrably) use this in a seperate cfg-file locally. 
  5.   filedesc.hdr should hold the header of your announcement and
  6.   filedesc.ftr should be the footer.
  7.   Adjust the variable "destfile" to the path where you want the
  8.   announcement to be created.
  9.  
  10.   Include this cmd-file in your "local" cfg-file for the tagger in the
  11.   Protocols Section like that:
  12.   
  13.   NoQuit P Generate_file-announcement FILEDESC.CMD
  14.  
  15. */
  16. call RxFuncAdd "SysFileTree", "RexxUtil", "SysFileTree"
  17. call RxFuncAdd "SysFileSearch", "RexxUtil", "SysFileSearch"
  18. arg com node filelist
  19.  
  20. destfile="d:\timed\tagger"
  21. dlcounterid="[" /*identifies dlcounter*/
  22.  
  23. namewid=13
  24. sizewid=6
  25. datewid=10
  26. linewid=75
  27. leftwid=namewid+sizewid+datewid
  28. descwid=linewid-leftwid
  29.  
  30. copy "filedesc.hdr" destfile
  31. filenum=0
  32. line=linein(filelist)
  33. do while line<>""
  34.   fname=word(line,1)
  35.   name=left(filespec("name",fname),namewid)
  36.   size=format(word(line,2) / 1024,sizewid-1,0)"k"
  37.   date=" "left(word(line,3),datewid-1)
  38.   linedesc=delword(line,1,3)
  39.   if substr(linedesc,1,1)="[" then  /*remove Dl-Counter (one word)*/
  40.     linedesc=delword(linedesc,1,1)
  41.   first=1
  42.   do while first=1 | word(linedesc,1)<>"" /*do once for each wrapped line*/
  43.     if first then do
  44.       first=0
  45.       leftspace=name""size""date""
  46.     end
  47.     else leftspace=left("",leftwid)
  48.     i=0
  49.     do while length(subword(linedesc,1,i+1))<descwid & word(linedesc,i+1)<>""
  50.       i=i+1 /*count max words to fill one line*/
  51.     end 
  52.     if i=0 then do /*cut word if too long*/
  53.       thisline=substr(linedesc,1,descwid)
  54.       linedesc=substr(linedesc,descwid+1,length(linedesc)-descwid)
  55.     end 
  56.     else do 
  57.       thisline=subword(linedesc,1,i)
  58.       linedesc=delword(linedesc,1,i)
  59.     end
  60.     rc=lineout(destfile,leftspace""thisline)
  61.   end
  62.   line=linein(filelist)
  63. end
  64. rc=lineout(filelist)
  65. rc=lineout(destfile)
  66. type "filedesc.ftr >> "destfile
  67. exit
  68.