EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Wish: new "Save a Copy as..." command
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
Stefan
Posted on: 10/30/2011 4:48 am
Home away from home
Joined: 7/14/2008
From: Germany, EU
Posts: 261
Wish: new "Save a Copy as..." command
I want to suggest an Edit menu option "Save a COPY as..."

Which ask for an new name
and save the current doc with that new name,
but leaves the current file with the current (old) name open.


This will help on making backups of current work.

Thanks.

- - -

Also there should be an macro command for that feature.

document.SaveCopyAs( [ strName ] );


-

currently i do that by an macro in several steps:

strOrig = document.FullName;
document.Save(strNewName);
editor.OpenFile( strOrig );



strOrig = document.FullName;
strPath = document.Path;
strBase = fBaseName(document.FullName);
strExte = fNameExt(document.FullName);
strDate = fCurrDateTime(); 
strNewName = strPath + "\\" +  strBase + "_" + strDate + "." + strExte;
//alert(strNewName);
document.Save(strNewName);
editor.OpenFile( strOrig );


function fBaseName(str)
{
   var base = new String(str).substring(str.lastIndexOf('\\') + 1); 
    if(base.lastIndexOf(".") != -1)       
       base = base.substring(0, base.lastIndexOf("."));
   return base;
}

function fNameExt(str)
{
   var exten = new String(str).substring(str.lastIndexOf('\\') + 1); 
    if(exten.lastIndexOf(".") != -1)       
       exten = exten.substring(exten.lastIndexOf(".")+1);
   return exten;
}


function fCurrDateTime()
{
  var currentDate = new Date();
  var day = currentDate.getDate();
  if (day < 10) day = "0" + day;
  var month = currentDate.getMonth();
  if (month < 10) month = "0" + month;
  var year = currentDate.getFullYear();
  vDate = year + "," + month + "," + day;

  var currentTime = new Date();
  var hours = currentTime.getHours();
  var minutes = currentTime.getMinutes();
  if (minutes < 10)  minutes = "0" + minutes;
  vTime = hours + "," + minutes;
  return vDate + "-" + vTime;
}
Flat Previous Topic | Next Topic


Subject Poster Date
 » Wish: new "Save a Copy as..." command Stefan 10/30/2011 4:48 am
     Re: Wish: new "Save a Copy as..." command chjfth 12/21/2011 4:49 pm

Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文