Macro: Renaming window for Concatenate

fiji

#1

This is what I want to work:

a=getTitle();
close();
run(“Concatenate…”, " title=[Concatenated Stacks] image1=[“a+” (red)] image2=[“a+” (green)] image3=[-- None --]");

This works but only with this specific image, and I need it to work for all images.

close();
run(“Concatenate…”, " title=[Concatenated Stacks] image1=[Project_M40 TA 009.tif (red)] image2=[Project_M40 TA 009.tif (green)] image3=[-- None --]");

Hello everyone,

I want to create a simple macro that will concatenate any image, not just the example I am using to record the macro.
I have been using a=getTitle();
and then later saying a+" (red)"
in other macros but this does not work with concatenating because it reads a+ as a part of the title always instead of my defined a=getTitle();

How can I work around this? Thanks


#2

Hi Andrew,

When concatenating strings (totally separate from the image concatenation!) you need a plus before and after the variable you are adding in.

The below should work:

run(“Concatenate…”, " title=[Concatenated Stacks] image1=[" + a + " (red)] image2=[" + a + " (green)] image3=[-- None --]");

What I find useful with commands like this which are all within smart quotes is replacing the “Run” function with a “Print”. What is printed should match what is recorder in the macro recorder for that image if everything is going right.

Good luck,
Laura


#3

It worked perfectly, Thank you!