- AuthorPosts
- October 30, 2011 at 12:19 pm #9765StefanParticipant
I would like to suggest two new macro properties:
document.BaseName
document.ExtensionCurrently there are “only”
document.Path
document.FullName
document.NameOn an example file “X:pathtofile with.dots.ext”
i expect to get:document.Path = “X:pathto”
document.FullName = “X:pathtofile 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;
}
June 26, 2015 at 1:12 am #20213StefanParticipantAnother piece of example code, related to the above one, for all who could need it:
strName = document.FullName;
strBase = fBaseName(document.Name);
strExte = fNameExte(document.Name);
//strNewName = strBase + "_Backup." + strExte;
strEEFolder = fPathName(editor.FullName);function fPathName(str)
{
if(str.lastIndexOf("\\") != -1)
path = str.substring(0, str.lastIndexOf("\\"));
return path;
}
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;
}
June 26, 2015 at 2:32 am #20214StefanParticipantCleaned-up Update:
strFullName = document.FullName;
strPath = fPathName(document.FullName);
strName = document.Name;
strBase = fBaseName(strName);
strExte = fNameExte(strName);
strPaBa = strPath+"\\"+strBase;
strNewName = strPath+ "\\" + strBase + "_Backup." + strExte;
strEEFolder = fPathName(editor.FullName);
strMyTool = strEEFolder + "\\Tools\\SubFolder\\application.exe";function fPathName(str)
{
if(str.lastIndexOf("\\") != -1)
path = str.substring(0, str.lastIndexOf("\\"));
return path;
}
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;
}
- AuthorPosts
- You must be logged in to reply to this topic.