Login  Register

Re: Help with macro

Posted by Miguel Tapia R. on Dec 06, 2016; 6:53pm
URL: http://imagej.273.s1.nabble.com/Help-with-macro-tp5017698p5017699.html

hi Pablo,

You could try to add the following lines to the beginning of your macro:

dir=getDirectory("Choose a Directory");
print(dir);
splitDir=dir + "\Treatments\\";
print(splitDir);
File.makeDirectory(splitDir);
list = getFileList(dir);

for (i=0; i<list.length; i++) {
     if (endsWith(list[i], ".lsm")){
               print(i + ": " + dir+list[i]);
             open(dir+list[i]);
             imgName=getTitle();
         baseNameEnd=indexOf(imgName, ".lsm");
         baseName=substring(imgName, 0, baseNameEnd);


and at the end the following:

saveAs("Tiff", splitDir+baseName + "-new.tif");
         
         close();
         close();
     }
     }


hope it helps, i'm new to the macro writing too


Miguel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html