Re: souce directory code for writing macro
Posted by
BenTupper on
URL: http://imagej.273.s1.nabble.com/souce-directory-code-for-writing-macro-tp3689273p3689276.html
On Feb 13, 2010, at 7:12 AM, Teresa W wrote:
> Hi Ben, could you show me how to embed this? Is this a line that
> goes at the
> start of the macro, or is it embedded within the line > e.g.
> *saveAs("Tiff",
> "File.dir\\Colour.tif");*? Thanks, Teresa
Hi,
I think that you want something like below. You should edit the the
first line to point an image that exists on your system. I print out
the srcDir in the third line so you can see that it is just string.
Also note that within the last command I use string math to
concatenate the directory and the filename. You can see that Wayne
has put in a wealth of file handling commands at ...
http://rsb.info.nih.gov/ij/developer/macro/functions.html#FCheers,
Ben
open("/Users/ben/Test.tif");
srcDir = File.directory();
print("srcDir=" + srcDir + " string length=" + lengthOf(srcDir));
outputFile = "Test-2.tif";
saveAs("Tiff", srcDir + outputFile);