home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Misc / countcharacters.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  624 b   |  33 lines

  1. !!script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. /**
  5. @Tool: countCharacters~counts characters in a file 
  6. not including carriage returns and new lines
  7. @EndTool: 
  8. @Summary: countCharacters~counts characters in a file
  9. */
  10.  
  11. var gOutput = getOutput();
  12.  
  13. function DoCommand()
  14. {
  15.   gOutput.clear();
  16.   var charCount = 0;
  17.   
  18.   var editor = getActiveEditor();
  19.   if (editor)
  20.   {
  21.     var lineCount = editor.getLineCount();
  22.     
  23.     for (var i = 0; i < lineCount; i++)
  24.     {
  25.       charCount += editor.getLineLength(i);
  26.     }
  27.   }
  28.   
  29.   gOutput.writeLine("Total char count: " + charCount);
  30. }
  31. !!/script
  32.  
  33.