Macro to propagate SetMinAndMax to two channels


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");
	setMinAndMax(-575, 6163);
	run("Make Composite");
	saveAs("Jpeg", directory + filenames[i] + ".jpg");
	run("Close All");

Any help would be much appreciated.