Using an Array for File Types
Hi,
I am attempting to make some changes to my script to basically prune it down a little.
My original script only allowed for the use of a handful of File Types and although the procedure to open each of these file types meant 4 lines of code each, I was fairly happy with that.
Now, however I wish to extend the bounds of the original handful of File Types so thought that containing them in an Array would be a better option.
I am stuck, I cannot seem to be able to pull the required extension from the Array without an error occuring. Here is a snippet of what I have so far.
var FILE_TYPE, FTlen, i;
FILE_TYPE = [".orf", ".tif", ".tiff", ".jpg", ".jpeg"];
FTlen = FILE_TYPE.length;
for (i = 0; i < FTlen; i++){
var SEARCH_MASK = "*" + FILE_TYPE;
var DARKfileList = DARKinputFolder.getFiles(SEARCH_MASK);}
if (DARKfileList.length <= 0){
for (i = 0; i < FTlen; i++){
var SEARCH_MASK = "*" + FILE_TYPE;
var DARKfileList = DARKinputFolder.getFiles(SEARCH_MASK);}
}
if (DARKfileList.length == 0)
{
alert('The DARK FRAME folder you have chosen is either empty or does not contain image files of the correct type.\r\rPlease locate & select the correct image folder.','DARK FRAME folder error');
DFgroup.DFlabel.text = 'No DARK FRAMES folder has been selected...';
DFdefault = '';
DFgroup.DFlabelQ.text = '';
}
What happens now when I run my script is that the folder browser opens as it should, I choose a folder with known file types matching the Array but it immediately shows me the Alert message that the folder does not contain images of the correct type.
Any help would be appreciated.
Kind regards...,