Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2007
    Posts
    452

    Huh? need help String.SplitPath

    i wanna show only name and extension or just name !!!!

    Code:
    myDocsFolder = Shell.GetFolder(SHF_MYDOCUMENTS);
    Folder.Create(myDocsFolder.."\\Addons");
    
    tblMenu = Application.GetMenu();
    local nNewitem = Table.Count(tblMenu)+1;
    tblMenu[nNewitem] ={};
    tblMenu[nNewitem].Text = "&Addons";
    tblMenu[nNewitem].ID = 1000;
    tblMenu[nNewitem].Checked = false;
    tblMenu[nNewitem].Enabled = true;
    tblMenu[nNewitem].SubMenu = {};
    
    local tFiles = File.Find(myDocsFolder.."\\Addons", "*.exe");
    if (tFiles) then
    for j,Path in tFiles do
    FileParts = String.SplitPath(Path);
    tFiles_File = FileParts.Filename..FileParts.Extension;
    end
    local x = 0;
    for x = 1,Table.Count(tFiles) do
    	tblMenu[nNewitem].SubMenu[x] = {};
    	tblMenu[nNewitem].SubMenu[x].Text = tFiles[x];
    	tblMenu[nNewitem].SubMenu[x].ID = 1000+x;
    	tblMenu[nNewitem].SubMenu[x].Checked = false;
    	tblMenu[nNewitem].SubMenu[x].Enabled = true;
    end
    Application.SetMenu(tblMenu);
    else
    end

  2. #2
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by GoOgLe View Post
    i wanna show only name and extension or just name !!!!

    Code:
    myDocsFolder = Shell.GetFolder(SHF_MYDOCUMENTS);
    Folder.Create(myDocsFolder.."\\Addons");
    
    tblMenu = Application.GetMenu();
    local nNewitem = Table.Count(tblMenu)+1;
    tblMenu[nNewitem] ={};
    tblMenu[nNewitem].Text = "&Addons";
    tblMenu[nNewitem].ID = 1000;
    tblMenu[nNewitem].Checked = false;
    tblMenu[nNewitem].Enabled = true;
    tblMenu[nNewitem].SubMenu = {};
    
    local tFiles = File.Find(myDocsFolder.."\\Addons", "*.exe");
    if (tFiles) then
    for j,Path in tFiles do
    FileParts = String.SplitPath(Path);
    tFiles_File = FileParts.Filename..FileParts.Extension;
    end
    local x = 0;
    for x = 1,Table.Count(tFiles) do
    	tblMenu[nNewitem].SubMenu[x] = {};
    	tblMenu[nNewitem].SubMenu[x].Text = tFiles[x];
    	tblMenu[nNewitem].SubMenu[x].ID = 1000+x;
    	tblMenu[nNewitem].SubMenu[x].Checked = false;
    	tblMenu[nNewitem].SubMenu[x].Enabled = true;
    end
    Application.SetMenu(tblMenu);
    else
    end
    try the string

    here is what the help file says one it:
    Code:
    Debug.ShowWindow(true);     --Shows the debug window.
    path_parts = String.SplitPath("C:\\MyFolder1\\MyFolder2\\myfile.exe");
    Debug.Print(path_parts.Drive.."\r\n");
    Debug.Print(path_parts.Folder.."\r\n");
    Debug.Print(path_parts.Filename.."\r\n");
    Debug.Print(path_parts.Extension.."\r\n");

  3. #3
    Join Date
    Mar 2007
    Posts
    452
    thanks rexzooly but i dont want to show debug window...

  4. #4
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by GoOgLe View Post
    thanks rexzooly but i dont want to show debug window...
    just take that out of the code


    ////EDITE

    path_parts = String.SplitPath("C:\\MyFolder1\\MyFolder2\\myfile .exe");

    sFilename = path_parts.Filename.path_parts.Extension

    try that

    but from what i can see you already have this on your code ???
    Last edited by rexzooly; 03-24-2008 at 03:57 AM.

  5. #5
    Join Date
    Mar 2007
    Posts
    452
    i tried it m8... it doesnt work !!!

  6. #6
    Join Date
    Oct 2007
    Posts
    233
    edit this example for yourself:
    path_parts = String.SplitPath("C:\\myfile.exe");
    name_ext=(path_parts.Filename..path_parts.Extensio n)

    Imprtant :
    1- no space in Extension word . when i paste it in here , it convert!
    2-yuo can replace a variable in ("C:\\myfile.exe");!!!!!!!
    Last edited by Esfahan; 03-24-2008 at 07:29 AM.

  7. #7
    Join Date
    Mar 2007
    Posts
    452
    still the same... i see the whole path !!!

    Code:
    myDocsFolder = Shell.GetFolder(SHF_MYDOCUMENTS);
    Folder.Create(myDocsFolder.."\\Addons");
    
    tblMenu = Application.GetMenu();
    local nNewitem = Table.Count(tblMenu)+1;
    tblMenu[nNewitem] ={};
    tblMenu[nNewitem].Text = "&Addons";
    tblMenu[nNewitem].ID = 1000;
    tblMenu[nNewitem].Checked = false;
    tblMenu[nNewitem].Enabled = true;
    tblMenu[nNewitem].SubMenu = {};
    
    local tFiles = File.Find(myDocsFolder.."\\Addons", "*.exe");
    if (tFiles) then
    path_parts = String.SplitPath(myDocsFolder.."\\Addons", "*.exe");
    name_ext=(path_parts.Filename..path_parts.Extension)
    local x = 0;
    for x = 1,Table.Count(tFiles) do
    	tblMenu[nNewitem].SubMenu[x] = {};
    	tblMenu[nNewitem].SubMenu[x].Text = tFiles[x];
    	tblMenu[nNewitem].SubMenu[x].ID = 1000+x;
    	tblMenu[nNewitem].SubMenu[x].Checked = false;
    	tblMenu[nNewitem].SubMenu[x].Enabled = true;
    end
    
    Application.SetMenu(tblMenu);
    
    else
    end

  8. #8
    Join Date
    May 2006
    Posts
    5,380
    RTFM RTFM RTFM RTFM

    its showing the full path coz you are telling it to

    change:
    Code:
    	tblMenu[nNewitem].SubMenu[x].Text = tFiles[x];

    to:
    Code:
    	tblMenu[nNewitem].SubMenu[x].Text = path_parts.Filename;
    also your split function needs to be inside the for loop
    Open your eyes to Narcissism, Don't let her destroy your life!!

  9. #9
    Join Date
    Mar 2007
    Posts
    452
    now i have 2 Addons item in the menu instead of exe files....

    Code:
    myDocsFolder = Shell.GetFolder(SHF_MYDOCUMENTS);
    Folder.Create(myDocsFolder.."\\Addons");
    
    tblMenu = Application.GetMenu();
    local nNewitem = Table.Count(tblMenu)+1;
    tblMenu[nNewitem] ={};
    tblMenu[nNewitem].Text = "&Addons";
    tblMenu[nNewitem].ID = 1000;
    tblMenu[nNewitem].Checked = false;
    tblMenu[nNewitem].Enabled = true;
    tblMenu[nNewitem].SubMenu = {};
    
    local tFiles = File.Find(myDocsFolder.."\\Addons", "*.exe");
    if (tFiles) then
    path_parts = String.SplitPath(myDocsFolder.."\\Addons", "*.exe");
    name_ext=(path_parts.Filename..path_parts.Extension)
    local x = 0;
    for x = 1,Table.Count(tFiles) do
    	tblMenu[nNewitem].SubMenu[x] = {};
    	tblMenu[nNewitem].SubMenu[x].Text = path_parts.Filename;
    	tblMenu[nNewitem].SubMenu[x].ID = 1000+x;
    	tblMenu[nNewitem].SubMenu[x].Checked = false;
    	tblMenu[nNewitem].SubMenu[x].Enabled = true;
    end
    
    Application.SetMenu(tblMenu);
    
    else
    end
    Last edited by GoOgLe; 03-24-2008 at 09:56 AM.

Similar Threads

  1. String.SplitPath
    By sside in forum AutoPlay Media Studio 5.0
    Replies: 7
    Last Post: 10-08-2004, 10:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts