New to macros - batch processing z stacks not working

Hello, I am new to macros, or at least trying to compile more “complex” ones. I am trying to batch process multiple .czi files of Z stacks with 3 channels (DAPI, 488 and BF). I used record to make simple macros to perform Z projection, split channels and save C2 as I want to focus on the 488/C2 images.

Running each part sequentially on a single image works, though I was having problems with the file names, so just decided to focus on getting the z projections and channel splitting done. I can do the Z projections from the .czi files, and save them in the designated folder. The channel plotting from the .tif file generated by the macro brings up the error “multiple image file needed” when i run batch processing. Running the macro on a single file works. As I have hundreds of images that will need processing, and will be generating hundreds more, I really want to automate what I can.

Any help/suggestions are appreciated.

###Code I’m using for Z stacks
run(“Z Project…”, “projection=[Sum Slices]”);
close();
###Code I’m using for splitting channels

//REmove unwanted channels from Z projection to measure total fluorescence
run(“Split Channels”);
close();

Cheers, Y