List Boxes and Recursive Searches

Multimedia Builder (Legacy Forum)
Post Reply
Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

List Boxes and Recursive Searches

Post 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?

weakzone
Posts: 10
Joined: Tue May 14, 2019 4:48 pm

Re: List Boxes and Recursive Searches

Post by weakzone »

Dear Sk8cynic,
Please check attached file.

Thanks
Attachments
SongList.zip
(18.7 KiB) Downloaded 59 times

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: List Boxes and Recursive Searches

Post 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.

polartech
Posts: 81
Joined: Sun Oct 31, 2010 3:29 am
Location: York, UK

Re: List Boxes and Recursive Searches

Post 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! :)

weakzone
Posts: 10
Joined: Tue May 14, 2019 4:48 pm

Re: List Boxes and Recursive Searches

Post by weakzone »

Dear Sk8cynic,
Please check attached file. Here I used a plugin name plugy for Open Multiple File.

Thanks
Attachments
SongList_MultiSelect.zip
(113.39 KiB) Downloaded 56 times

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: List Boxes and Recursive Searches

Post by Sk8cynic »

Weakzone,

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

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: List Boxes and Recursive Searches

Post 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!

weakzone
Posts: 10
Joined: Tue May 14, 2019 4:48 pm

Re: List Boxes and Recursive Searches

Post 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
Attachments
SongList_MultiSelect_update.zip
(113.55 KiB) Downloaded 56 times

Sk8cynic
Posts: 29
Joined: Thu Oct 04, 2012 12:51 pm

Re: List Boxes and Recursive Searches

Post 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.... ;)

Post Reply