EmEditor (text editor) Forum Index
   Enhancement Suggestions about Macros
     Wish: document.BaseName + document.Extension
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
Stefan
Posted on: 10/30/2011 4:19 am
Home away from home
Joined: 7/14/2008
From: Germany, EU
Posts: 285
Wish: document.BaseName + document.Extension
I would like to suggest two new macro properties:

document.BaseName
document.Extension

Currently there are "only"
document.Path
document.FullName
document.Name

On an example file "X:\path\to\file with.dots.ext"
i expect to get:

document.Path = "X:\path\to"
document.FullName = "X:\path\to\file with.dots.ext"
document.Name = "file with.dots.ext"

and new suggested:
document.BaseName = "file with.dots"
document.Extension = "ext"


- - -

Currently an user have to do this on his own:


strBase = fBaseName(document.Name);
strExte = fNameExte(document.Name);

strNewName =  strBase + "_Backup." + strExte;
alert(strNewName);



//--------------------------------
function fBaseName(str)
{
    if(str.lastIndexOf(".") != -1)       
       base = str.substring(0, str.lastIndexOf("."));
   return base;
}

function fNameExte(str)
{
    if(str.lastIndexOf(".") != -1)       
       exten = str.substring(str.lastIndexOf(".")+1);
   return exten;
}
Threaded | Oldest First Previous Topic | Next Topic | Top


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