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

  1. !!script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3. // @Created by Roger Gouin 12/20/98
  4. // @Modified by Roger Gouin 12/21/98
  5. // @Modified build 247 cm19981228 
  6.  
  7. /**
  8. @Tool: findFiles~lists files matching the search parameters. The
  9. search parameters can include '*' and '?' and ';'. The '*' matches
  10. any number of characters, the '?' matches any one character and the
  11. ';' starts a new search expression.
  12. @EndTool: 
  13. @Summary: findFiles~lists files matching the search parameters
  14. */
  15.  
  16. var gOutput = getOutput();
  17.  
  18. function DoCommand()
  19. {
  20.     gOutput.clear();
  21.     
  22.     var directory = chooseDirectory("Find file: Select a directory to search");
  23.     if (directory == null) return;
  24.  
  25.     var findExpression = prompt("Find file: Enter search expression with wild cards",
  26.         "*.*");
  27.     
  28.     if (findExpression == "") return;
  29.  
  30.     var fileList = getDirectoryFiles(directory, findExpression, true);
  31.     if (fileList == null) return;
  32.     
  33.     gOutput.writeLine(
  34.     "Find files matching \"" + findExpression + "\"\n");
  35.     
  36.     var count = 0;
  37.     var position = fileList.getHeadPosition();
  38.     while (position && position.valid)
  39.     {
  40.         count++;
  41.         var file = fileList.getNext(position);
  42.         // Use the writeMessage method to make the output "double-clickable"
  43.         gOutput.writeMessage(file.path, 0, "");
  44.     }
  45.     
  46.     gOutput.writeLine("\n------ " + count + " file(s) found-----");
  47.     gOutput.writeLine("End of find files list");            
  48. }
  49.  
  50.  
  51. !!/script
  52.  
  53.