// 20150818 Akira Muto ///////////// Specifying the data folders and making a list of subfolders source_dir = getDirectory("Please select the data folder."); dest_dir = getDirectory("Please select a folder where the results will be saved."); print("Data folder:"+source_dir); print("Results folder:"+dest_dir); sub_dir_list = getFileList(source_dir); //Needed for WINDOWS OS. The file separator is "\\" in WIndows7, "/" in MacOS for(i=0; i0) {selectImage(nImages); close();}//Closing all the image windows resultsfilename=sub_dir_list[k]+"Results.txt"; resultsfilename=replace(resultsfilename,File.separator,"_"); saveAs("Results", dest_dir+resultsfilename); selectWindow("Results");run("Close"); print("Results was saved as "+dest_dir+resultsfilename); SummaryWindowName="Summary of "+sub_dir_list[k]; SummaryWindowName=substring(SummaryWindowName,0,lengthOf(SummaryWindowName)-1);//To remove the last character (which is the file separator) summaryfilename=sub_dir_list[k]+"Summary.txt"; summaryfilename=replace(summaryfilename, File.separator,"_"); selectWindow(SummaryWindowName); saveAs("Text", dest_dir+summaryfilename); selectWindow(SummaryWindowName); run("Close"); print("Summary was saved as "+dest_dir+summaryfilename); ///////////// End of the batch processing }//The end of the for-loop