home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Recent / text / edit / WordCount-CED.lha / Word-Count-Fast.ced next >
Text File  |  2000-07-16  |  850b  |  43 lines

  1. /*
  2. ** Word-Count-Fast.ced V1.3 by M.Bethke
  3. */
  4.  
  5. OPTIONS RESULTS
  6.  
  7. STATUS BLOCKY
  8. blocky = result
  9. if blocky = -1 then do
  10.   status cursorline
  11.   cline = result
  12.   cline = cline+1
  13.   "beg of file"
  14.   mark
  15.   if result=0 then mark
  16.   "end of file"
  17.   "copy"
  18.   "save clip as T:wordcount.ced.tmp 1"
  19.   "jump to line" cline
  20. end
  21. else do
  22.   copy
  23.   "save clip as T:wordcount.ced.tmp 1"
  24. end
  25.  
  26. open('TMP','T:wordcount.ced.script','W')
  27. writeln('TMP',"stack 50000")
  28. writeln('TMP',"wc T:wordcount.ced.tmp >T:wordcount.ced.wc")
  29. writeln('TMP',"delete QUIET T:wordcount.ced.tmp")
  30. close('TMP')
  31.  
  32. address command "execute T:wordcount.ced.script"
  33.  
  34. open('OUT','T:wordcount.ced.wc','R')
  35. res = readln('OUT')
  36. close('OUT')
  37.  
  38. parse VALUE res WITH lines words chars rest
  39.  
  40. address command "delete QUIET T:wordcount.ced.#?"
  41.  
  42. OKAY1 "Counted" lines "lines, " words "words and " chars "characters"
  43.