Collect a list of files from a folder.
Greetings everyone!
I'm trying to create a user interface containing a listbox and some buttons (find, remove and process), I wanted to make this functional as follows:
1-: When I click on the "Find" button, it will search for a folder so that I can select some images. jpg, png, tiff ......
2-: Add to Listbox a list of all selected images.
3-: How to remove an item from the Listbox using the "Remove" button.
4-: Open and do anything on each image in the list when I click the "OK" button.

That was all I got so far. All help is valid;
dialog = new Window("dialog");
dialog.text = "Dialog";
lbx_array = "";
lbx = dialog.add("listbox", undefined, undefined, {name: "lbx", items: lbx_array});
lbx.preferredSize.width = 100;
lbx.preferredSize.height = 100;
b1 = dialog.add("button", undefined, undefined, {name: "b1"});
b1.text = "Localizar";
b1.onClick = function() {
var selectedFolder = Folder.selectDialog("Please select folder");
var fileList= selectedFolder.getFiles(/\.(?:png|gif|jpg|bmp|tif|psd)$/i);
lbx_array = fileList;
dialog.update();
}
b2 = dialog.add("button", undefined, undefined, {name: "b1"});
b2.text = "Remove";
b3 = dialog.add("button", undefined, undefined, {name: "b2"});
b3.text = "Ok";
dialog.show();
Thank you!
