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

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3. // @Modified build 239 cm19981206
  4.  
  5. /**
  6. @Tool: renameFile~displays a dialog to allow you to 
  7. rename the active editor.
  8. @EndTool: 
  9. @Summary: renameFile~rename the active editor
  10. */
  11.  
  12. function DoCommand()
  13. {
  14.     var editor = getActiveEditor();
  15.     if (editor)
  16.     {
  17.         var file = editor.GetFile();
  18.         if (file.exists) //cm19981206
  19.         {
  20.             var newFile = confirmFile("Rename the file", "", file, "*.*");
  21.             if (newFile)
  22.             {
  23.                 editor.rename(newFile.path);
  24.             }
  25.         }
  26.         else
  27.         {
  28.             alert("Cannot rename an untitled file");
  29.         }
  30.     }
  31. }
  32.  
  33. !!/Script
  34.  
  35.