home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
- // @Modified build 239 cm19981202
- // @Modified build 275 cm19990315 - update recent files on rename
- // @Modified build 290 cm19990426 - added DoUpdate function
-
- /**
- @Tool: renameFile~displays a dialog to allow you to
- rename the active editor.
- @EndTool:
- @Summary: renameFile~rename the active editor
- */
-
- function DoUpdate(cmdUI)
- {
- cmdUI.enable(getActiveEditor() != null);
- }
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var file = editor.GetFile();
- if (file.exists) //cm19981202
- {
- var newFile = confirmFile("Rename the file", "", file, "*.*");
- if (newFile)
- {
- editor.rename(newFile.path);
-
- //cm19990315
- var recentFilesScript = getScriptObject("\\EventHandlers\\Menu Handlers\\onRecentFiles.script");
- if (recentFilesScript)
- {
- recentFilesScript.AddRecent(editor.path);
- }
- }
- }
- else
- {
- alert("Cannot rename an untitled file");
- }
- }
- }
-
- !!/Script
-
-