Login  Register

Re: Macro question: Default directory for saving content of text window

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jun 16, 2011; 2:07am
URL: http://imagej.273.s1.nabble.com/Macro-question-Default-directory-for-saving-content-of-text-window-tp3684217p3684218.html

On Jun 13, 2011, at 8:08 PM, David Goldenberg wrote:

> Hi,
>    I am working on an ImageJ macro that involves generating a text  
> window with run("Text Window..."), which the user can then save to a  
> file.  When the user chooses File > Save As ..., the default directory  
> is always the ImageJ macros directory.  This is not good for anyone  
> involved!  Is there any way, within the constraints of the macro  
> language, to set the default directory for saving?

You can set the default text editor directory for saving in a macro using:

    call("ij.plugin.frame.Editor.setDefaultDirectory", dir);

In a script or plugin use:

    Editor.setDefaultDirectory(dir);

And, starting with the 1.45j daily build, the default text editor directory is saved in the preferences file.

-wayne