path = getDirectory("Choose a Directory");
filename = getFileList(path);
newDir = path + "Max Projections" + File.separator;
if (File.exists(newDir))
   exit("Destination directory already exists; remove it and then run this macro again");
File.makeDirectory(newDir);
for (i=0; i<filename.length; i++) {
	if(endsWith(filename[i], ".lsm")) {
		open(path+filename[i]);
		run("Z Project...", "projection=[Max Intensity]");
run("Channels Tool... ");
Stack.setDisplayMode("composite");
run("Stack to RGB");
		saveAs("tiff", newDir + getTitle);
		close(); close();close();
	}
}