http://imagej.273.s1.nabble.com/open-file-with-specific-partial-name-tp5002910p5002913.html
i.e.
> Dave,
> This may be helpful:
>
> dir=getDirectory("Select the directory");
> list=getFileList(dir);
> for(i=0;i<list.length;i++){
> if(endsWith(list[i],".tif")&&indexOf(list[i],"foes")=1){
> do stuff;
> }
> }
>
> or find the files and concatenate the into an array of chosen files to batch process them:
>
> files=newArray(0);
> dir=getDirectory("Select the directory");
> list=getFileList(dir);
> for(i=0;i<list.length;i++){
> if(endsWith(list[i],".tif")&&indexOf(list[i],"foes")=1){
> files=Array.concat(files,list[i]);
> }
> }
> for(f=1;f<files.length;f++){
> open(files[f]);
> doStuff;
> }
>
>
> also, look at some of the macros on the ImageJ website.
> Regards
> Glen MacDonald
> Core for Communication Research
> Virginia Merrill Bloedel Hearing Research Center
> Cellular Morphology Core
> Center on Human Development and Disability
> Box 357923
> University of Washington
> Seattle, WA 98195-7923 USA
> (206) 616-4156
>
[hidden email]
>
>
>
> On May 3, 2013, at 10:01 AM, "Kline, David D." <
[hidden email]> wrote:
>
>> Thank you in advance for any help.
>>
>> We are trying to write a macro that opens a file with a particular word/text in the file name. For example if the file is named "dave_fos_40X.tif" how can we have IJ only open the file that contains the word "foes". This is needed because there may be many files in the same folder with a similar name (e.g., "dave_neurons_40X.tif", "dave_glia_40X.tif"). There is usually only one file with the text "foes" in the folder. We have tried using wildcards and renaming the files with no success. There must be a simple way that I am not seeing.
>>
>> Any advice is appreciated.
>>
>> Thanks!
>> Dave
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
Dept. Radiation Oncology
McKnight Brain Inst. Rm LG-177