PDA

View Full Version : list files contained in a folder via list box?


hereisjoy
04-25-2008, 03:32 PM
Let me start by saying I am not a programmer just a self leaner. I am test driving AutoPlayMedia Studio 7.0 in researching it as the software to use for building autorun cds for various projects. One of the things I must be able to do is show in a list the files contained in a folder, select one or multiple files (like a pdf) and have it open in the appropriate reader window. I can't figure out which action to use for showing the file names in a folder as a means to populate a list of some sort.

Any help, suggestions, example code etc would be wonderful.

thanks
hereisjoy

RizlaUK
04-25-2008, 04:33 PM
heres a function i use all the time to add a folder of files to a listbox

place this function in the global area
-- FolderToListbox(string Object, string Folder, boolean Recurse, tabel Filters)
-- adds the files with the filters to a listbox
function FolderToListbox(strObject,strFolder,bRecurse,tbFil ters)
for index, strExt in tbFilters do
tbFile = File.Find(strFolder, strExt, bRecurse, false, nil, nil);
if tbFile then
for index, strPath in tbFile do
local sPath= String.SplitPath(strPath);
ListBox.AddItem(strObject, sPath.Filename, strPath);
end
end
end
end


when you want to fill your list call the function like:
FolderToListbox("ListBox1", "AutoPlay\\Docs", false, {"*.mp3","*.wma"})

hope that helps

hereisjoy
04-25-2008, 11:02 PM
I will try it. Thanks so much for your help.