Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9765

    Stefan
    Participant

    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: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;
    }
    #20213

    Stefan
    Participant

    Another 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;
    }

    #20214

    Stefan
    Participant

    Cleaned-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;
    }

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Share with friends... Tweet about this on TwitterShare on FacebookShare on Google+Email this to someone