How to select automatically a window

Dear all,
I have opened four images (four channels). How can I write a macro to automatically select the window containing channel C=0?
Thanks

@mvizoso
Does that answer your question?

run(“Clown (14K)”);
run(“Split Channels”);
selectWindow(“clown.jpg (red)”);
selectWindow(“clown.jpg (blue)”);
selectWindow(“clown.jpg (green)”);

A method that I often use: I use Plugin —> Macro —> record
The software gives me the macro command.