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

  1. !!Script
  2. // Modified by Roger Gouin 12/19/98
  3. // Print files in sorted order - can use with FinePrint for more than one
  4. // file on a page.
  5.  
  6. function DoCommand()
  7. {
  8.     var fileList = chooseFiles("Files to print", "*.*", "*.*");
  9.     if (!fileList) return;
  10.     
  11.     fileList.sort(compareItems);
  12.     var position = fileList.getHeadPosition();
  13.     while (position && position.valid)
  14.     {
  15.         var file = fileList.getNext(position);
  16.         var editor = openEditor(file.path, false);
  17.         if (editor)
  18.         {
  19.             editor.print();
  20.         }
  21.     }    
  22. }
  23.  
  24. function compareItems(itemA, itemB)
  25. {
  26.     // Assumes itemA and itemB are Association objects
  27.     itemApath = itemA.path.toLowerCase();
  28.     itemBpath = itemB.path.toLowerCase();
  29.     if (itemApath < itemBpath) return -1;
  30.     if (itemApath == itemBpath) return 0;
  31.     
  32.     return 1;
  33. }
  34.  
  35. !!/Script
  36.  
  37.