Macro question: Default directory for saving content of text window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro question: Default directory for saving content of text window

David Goldenberg
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?

Thanks very much,
David
Reply | Threaded
Open this post in threaded view
|

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

Rasband, Wayne (NIH/NIMH) [E]
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
Reply | Threaded
Open this post in threaded view
|

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

David Goldenberg
Fantastic!  That's just what I needed. I guess, though, that what I  
really need is to know more about what is available through the api.

Thanks,
David

On Jun 15, 2011, at 8:07 PM, Rasband, Wayne (NIH/NIMH) [E] wrote:

> 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

--
Department of Biology
University of Utah
257 South 1400 East
Salt Lake City, UT  84112-0840

Telephone: (801) 581-3885
Fax:  (801) 581-2174

E-mail: [hidden email]
Lab web page: http://www.biology.utah.edu/goldenberg