Apply a macro for different image stacks which are opened

Hello :slight_smile:
I have different opened image stacks and I would like to do the same to all of them: as an example “setMinAndMax” or Rotate 90 degrees left to all of them.
I’ve tried the following code:
dir1 = getDirectory(“Choose directory”);
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
setMinAndMax(0, 1)(i+1, list.length);
}
However, I get the error in the attached image:
image

Could someone help me?

Thank you in advance!
Marta

Hi Marta,

In this bit:

What is the (i+1, list.length) part doing? Once this is removed, it seems to behave.

If I separate this bit:

setMinAndMax(0, 1);
(i+1, list.length);

the second line runs into an error, but the first one completes its job.

Here is perhaps another useful thread regarding applying a macro to stack (rather than to single image):

Best wishes :slight_smile: