Is there an easy way to select a window who name ends with a particular name?

Hi, being a biologist with zero knowledge of programing (and a newbie to ImageJ), I am asking a naive question. If the name of one of the open windows is “_20200921_DAPI, FITC, Cy3, Cy5, C=1)”, is there a way in the beginning of the macro I can selectWindow whose name ends with C=1? In each folder I have files whose name ends with C=0.tif or C=1, 2, 3. I need to select the window ending with C=1 then add overlay of another window (C=3). Would have been easy if I can just say “”*C=1.tif" the way it works in Windows :slight_smile:

Dear @Anurag
I was unable to get regex working in the selectWindow() function. However, I found this work around which gets all open images and then selects the one with “C=1”

list = getList("image.titles");

for(i = 0;i<list.length;i++){
	if(matches(list[i],".*C=1.*")){
		selectWindow(list[i]);
	}
}

Let me know if this helps

2 Likes

Oh wow!!! This worked exactly how I wanted!!! Thanks and I really appreciate it.

1 Like