Login  Register

Re: How can I get the directory of a macro file?

Posted by Straub, Volko A. (Dr.) on May 09, 2018; 8:02am
URL: http://imagej.273.s1.nabble.com/How-can-I-get-the-directory-of-a-macro-file-tp5020635p5020638.html

No need to copy the macro into a different folder to work on different sets of images. If you want to process files in a different folder, use the getDirectory(string) command to get the path to your files. Have a look at the documentation for the built-in macro functions (https://imagej.nih.gov/ij/developer/macro/functions.html#G) for further information and links to examples.
Hope this helps,
Volko

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband
Sent: 09 May 2018 05:42
To: [hidden email]
Subject: Re: How can I get the directory of a macro file?

> On May 8, 2018, at 11:27 PM, bens0545 <[hidden email]> wrote:
>
> I want to copy my macro file into different folders, and have the
> macro operate on the files in that folder. Currently I am typing the
> new directory path into the macro, but I would like the macro to get
> the directory that it is in automatically. How can I do this?

The File.directory() macro function returns the path to the directory that a macro was loaded from.

-wayne

> --
> Sent from: http://imagej.1557.x6.nabble.com/

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

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