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

  1. !!script
  2. // Copyright ⌐ 1997-2000 - Modelworks Software
  3.  
  4. /**
  5. @Tool: findLongLinesInOpenDocuments~finds long lines in all open documents. 
  6. @EndTool: 
  7. @Summary: findLongLinesInOpenDocuments~finds long lines in all open documents
  8. */
  9.  
  10. var gOutput = getOutput();
  11.  
  12. function DoCommand()
  13. {    
  14.     gOutput.clear();
  15.     gOutput.writeLine("Looking for long lines:");
  16.     
  17.     var count = 0;
  18.     var index = 0;
  19.     var lineIndex = -1;
  20.     var editor = getEditor(index++);
  21.     while (editor)
  22.     {
  23.         var fileName = editor.path;
  24.         
  25.         var maxLineCount = editor.getLineCount();
  26.         for (var i = 0; i < maxLineCount; i++)
  27.         {            
  28.             // Only print out one message per line
  29.             if (editor.getLineLength(i) > 80)
  30.             {
  31.                 gOutput.writeMessage(fileName, i, editor.copy(lineIndex));
  32.                 count += 1;
  33.             }
  34.         }
  35.         editor = getEditor(index++);
  36.     }
  37.     gOutput.writeLine("Found " + count + " long lines");
  38. }
  39.  
  40. !!/script
  41.     
  42.