Change between 2 images in Fiji, if only the beginning of the name is constant

I am trying to create a very simple macro and I am stuck at a certain point. Can someone please help me? Thanks in advance!
I start by opening 2 images by hand. Then I would like to start the Macro.
The fist image is always called:
“089 - Composite (RGB).tif”
(whereas the numbers change, for the example I used 089)
The second image is called
“086 - Composite (RGB).tif (green) SNc_left”
For that second image, the term after green changes, which means, the region I am looking at changes.
I would like to process the images further and would like to choose between those two images. As the second name includes the first it shouldnt be so difficult to give them 2 variables, but I don’t find the right command. I was thinking about something like that by using a placeholder, does a placeholder for strings exist?

a = getTitle();
selectWindow(a+" (green)+"%s");
b = getTitle();

Thanks a lot for your help!


I do not understand. Why don’t you use “rename”?
image -> rename

for example:
run(“Duplicate…”, " ");


Thanks for your quick answer, @Mathew .

Easier explained I would like to change between two pictures as if I pressed the keys Ctrl., Maj., Tab together.

My problem is, that I am talking about two different pictures, that I would like to work with together. I will copy the whole code into the chat, so that it becomes more visible what I mean. Basically the only thing I would like to do is, to use the name of the picture where I marked a certain region with the the lasso tool (like SN_left) for the name of my composite image in the end.
The colocalized image will be called: a+"ColocalizedROI at the moment. I would like to give it the name of the region, that I marked with the lasso tool.

Here my code:

//The composite image and the lasso tool image must be opened
//The composite image must be chosen

//1 step: GetTitle and Split channels of the Composite image
a = getTitle();
run(“Split Channels”);
selectWindow(a+" (blue)");
run(“Restore Selection”);
selectWindow(a+" (red)");

// Step 2: Produce a Colocalized Image of the ROI and save it
// The colocalized image will be called: a+“ColocalizedROI at the moment.”
selectWindow(a+" (red)");
run(“Restore Selection”);
run(“Colocalization Threshold”, “channel_1=[”+a+" (red)] channel_2=["+a+" (green)] use=[Channel 1] channel=[Red : Green] show use_0 include");
saveAs(“Tiff”, “D:/15-Colocalized Images/”+a+“ColocalizedROI”);

I finally found the solution. Sorry, it ws really easy, just didnt know the function…
It was the put behind-Function I was looking for…

a = getTitle();
run(“Put Behind [tab]”);
b= getTitle();