Merge all opened images into composite macro

Hello,
I would like to create an overlay of several images with the following command in batch macro :
run(“Merge Channels…”, “c1=[”+ imageTitle1 +"] c2=["+imageTitle2 +"] c3=["+ imageTitle3 +"] c4=["+ imageTitle4 +"] c5=[" + imageTitle5 +"] c6=[" + imageTitle6 +"] create");
However, the channels are not always the same from one processing to another, and I need this step to work for a macro which could have 3 to 5 overlays.
So far, I tried to assign black images (which are quite long to create) for undefined channels, I cannot create a variable None either…

Thank you in advance for your help !

PS : I’m new to ImageJ so I hope it was clear enough…