Macro to propagate SetMinAndMax to two channels

Hello,

I am completely new to image processing so apologies the very basic question. I have images with two channels, both of which I’d like to adjust to similar brightness/contrast levels. I am looking to write a macro that does this, however my recorder does not record the fact that I tick “propagate to the other channel of this image”. This function setMinAndMax(min, max, channels) requires an RGB image, but I don’t know if it’s a good idea to convert my image to RGB before processing it?

This is roughly what I am aiming for:

directory = "/path_to_directory/";
filenames = getFileList(directory);

for (i = 0; i < 12; i + 1) {
	open(directory + filenames[i]);
	run("Duplicate...", "title=duplicate duplicate");
	run("Brightness/Contrast...");
	setMinAndMax(-575, 6163);
	run("Make Composite");
	saveAs("Jpeg", directory + filenames[i] + ".jpg");
	run("Close All");
}

Any help would be much appreciated.

Cheers,
L