Re: open file with specific partial name
Posted by
Herbie-2 on
May 03, 2013; 5:20pm
URL: http://imagej.273.s1.nabble.com/open-file-with-specific-partial-name-tp5002910p5002912.html
Dave,
May I suggest a macro that first creates a file list from the desired
directory by use of
arrayOfNames = getFileList( directoryPath );
Then loop through the array and test for the desired "substring" by
idx = indexOf( arrayOfNames[i], substring );
If ( idx >= 0 ) then the substring is part off the
name = arrayOfNames[i]
and you may use it for opening the file.
HTH
Herbie
________________________________________
On 03.05.13 19:01, Kline, David D. 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