Page 1 of 1

List Boxes and Recursive Searches

PostPosted: Wed Jul 03, 2019 10:52 am
by Sk8cynic
A little help, please...

I am trying to find a way to populate a list box with the contents of a folder that resides in a sub-folder inside the <SrcDir> folder, such as <SrcDir>\Music1, etc. With the code shown below, I am able to populate the list box, but a recursive search is done and lists the content of ALL of the subfolders below the <SrcDir> instead of just the folder I want. Is this possible to do? Here is the code I currently have that doesn't work:

SearchForFiles("<SrcDir>","Music1","*.mp3")
ListBoxAddItem("SongList","RESET")
ListBoxAddItem("SongList","<List>")
ListBoxSortItems("SongList","NAME")
SongListReset()
ListBoxGetItems("SongList","<List>")

According to the Help file, a recursive search is always done on the <SrcDir> which then causes a complete listing. I also looked at some of the MMB examples, but didn't find a solution.

BTW, anybody heard from Delboy?

Re: List Boxes and Recursive Searches

PostPosted: Wed Jul 03, 2019 3:53 pm
by weakzone
Dear Sk8cynic,
Please check attached file.

Thanks

Re: List Boxes and Recursive Searches

PostPosted: Thu Jul 04, 2019 10:53 am
by Sk8cynic
Hi Weakzone,

Thank you very much for your help! Now I just have to figure out how to do multi-select on files and load those into the list box.

Re: List Boxes and Recursive Searches

PostPosted: Mon Jul 08, 2019 1:45 am
by polartech
Sk8cynic wrote:
BTW, anybody heard from Delboy?


Good question.. just looked at his profile and last visited is showing as

Tue Oct 09, 2018 2:57 pm

Hope he is ok! :)

Re: List Boxes and Recursive Searches

PostPosted: Tue Jul 09, 2019 11:39 am
by weakzone
Dear Sk8cynic,
Please check attached file. Here I used a plugin name plugy for Open Multiple File.

Thanks

Re: List Boxes and Recursive Searches

PostPosted: Wed Jul 10, 2019 10:57 pm
by Sk8cynic
Weakzone,

Once again...thank you so much for your help!

Re: List Boxes and Recursive Searches

PostPosted: Wed Jul 17, 2019 3:00 pm
by Sk8cynic
Weakzone / Others,

Thank you for the help on multi-selection of music files. Here is the code that performs this task with the plugy.dll plugin:

status = 0
ListBoxAddItem("SongList","RESET")
SongListReset()
***
filter$='Audio files|*.mp3|Any files|*.*||'
PluginSet("plugy","filter$")
PluginRun("plugy","d_filter")
title$='Multi Select Files'
PluginSet("plugy","title$")
PluginRun("plugy","d_multi_title")
PluginRun("plugy","d_multi_open")
PluginGet("plugy","status")
If (status) Then
For i=1 To status
**file
PluginSet("plugy","i")
PluginRun("plugy","d_file")
PluginGet("plugy","files$")
****
ListBoxAddItem("SongList","STRING:files$")
ListBoxAddItem("SongList","<List>")
Next i
***
ListBoxSortItems("SongList","NAME")
**SongListReset()
ListBoxGetItems("SongList","<List>")
End

Is there a way to modify the above code so that when files are selected, only the music file name such as mysong.mp3 is listed and not the full path of the file(s)?

Thanks!

Re: List Boxes and Recursive Searches

PostPosted: Wed Jul 17, 2019 6:09 pm
by weakzone
Dear Sk8cynic,
Please check attached file. Here I used a temporary file for save and load list. You can delete after Song List Reset.

Thanks

Re: List Boxes and Recursive Searches

PostPosted: Wed Jul 17, 2019 9:24 pm
by Sk8cynic
Hi Weakzone,

Once again....thank you for your help.

I tried the revised code. Initially, it works and does not display the complete path. However, If I try to add files to the list a second time (append) without clearing it first, the entry is multiplied and duplicated even if different files are selected. A third attempt to load files results in the entire folder being loaded even if one or two files are selected.

Strange.... ;)