Announcement

Collapse
No announcement yet.

Not showing File Path on ListBox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not showing File Path on ListBox

    Can someone please help with following code, only shows file name an extension on list box., I wanted to show file path as well.
    Code:
    	if e_Key == 13 then
    
    -- name the folder you wish to search
    -- sSearchFile = _DesktopFolder.."\\files"; -- This if you want the folder is in Desktop
    
    sSearchFile = "c:\\search\\"; -- folder path * drive *
    
    --name listbox as a vaiable
    LB = "LB_FileListStep1";
    
    --delete all existing entries in the listbox
    ListBox.DeleteItem(LB, -1);
    
    --get the text entered in the input box and store as a variable
    sFileSearch = Input.GetText("Input_FileSearch");
    
    	--if the input box was empty then notify the user
    
    	if sFileSearch== "" then
    	Dialog.Message("Notice", "PLEASE ENTER FILE NAME AND CLICK SEARCH  ", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    Page.SetFocus("Input_FileSearch")
    Input.SetText("Input_FileSearch", "");
    	--input was not empty so perform search
    	else
    
    	--get the selected search type from the combobox item 
    	nSelectedSearch = ComboBox.GetSelected("Combo_Search");
    
    		--if searchtype is valid then continue
    		if nSelectedSearch ~=-1 then
    
    		--get the item data for the search type 1=wildcar 2=exact match
    		sSearchType = ComboBox.GetItemData("Combo_Search", nSelectedSearch);
    
    		--convert the search type to a number so we can compare it
    		nSearchType = String.ToNumber(sSearchType);
    			
    			--determine the search method and if its wildcard adjust the search file value
    			if nSearchType == 1 then sFileSearch = "*"..sFileSearch .."*.*";
    			end
    
    		--search for the file and store all results in a table	
    		tFiles = File.Find(sSearchFile, sFileSearch, true, false, nil, nil);
    
    			--if the table contains at least one value then continue
    			if tFiles then
    
    			--step through the table adding the file found results to the listbox
    			for i, FilesPath in pairs(tFiles) do
    				FileNameStart = String.ReverseFind(FilesPath, "\\", false) +1; --find the starting pos of the file name
    				FileNameLength = String.Length(FilesPath) - (FileNameStart -1); -- find the length of the cutoff 
    				FileName = "".. String.Mid(FilesPath, FileNameStart, FileNameLength); -- build the FileName
    				result = Folder.Find("files", "AutoPlay*", false, nil);
    
    				ListBox.AddItem(LB, FileName, FilesPath);			
    			end			
    
    		-- table contained no values hence file was not found notify user
    		else
    		Dialog.Message("SEARCH RESULT", "THERE ARE NO FILES IN THIS FOLDER Please Try Again  ");
    		end
    		Page.SetFocus("Input_FileSearch")
    		Input.SetText("Input_FileSearch", "");
    	end
    			end
    --restore search button
    Button.SetEnabled("Button_Search", true);
    end
Working...
X