Login  Register

Re: Forward slashes do not work for default directories

Posted by Stein Rørvik on Nov 14, 2017; 10:54am
URL: http://imagej.273.s1.nabble.com/Forward-slashes-do-not-work-for-default-directories-tp5019697p5019705.html

Thanks for the quick fix, works great!

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband
Sent: 14. november 2017 00:07
To: [hidden email]
Subject: Re: Forward slashes do not work for default directories

> On Nov 13, 2017, at 9:53 AM, Stein Rørvik <[hidden email]> wrote:
>
> I need to set the default directory for saving both images and text in a macro.
> According to various mailing list postings this can be done using a
> javascript call to ij.io.OpenDialog.setDefaultDirectory for images and ij.plugin.frame.Editor.setDefaultDirectory for text.
>
> The problem is that it does not work for me if the filepath is using forward slashes.
> I prefer to use forward slashes as they are far more compatible and do not need escaping.
> I am using daily build ImageJ 1.51s on Windows 7 64-bit.

This bug is fixed in the latest ImageJ daily build (1.51s23).

-wayne


> Here is a test macro illustrating what I want to do:
>
> //The following does not work:
> dir = "C:/Users/steinr/ImageJ/Files/";
> call("ij.plugin.frame.Editor.setDefaultDirectory", dir);
> call("ij.io.OpenDialog.setDefaultDirectory", dir); //saveAs path for
> both Text windows and images are set to the last used directory for
> saving
>
> //The following works as expected:
> dir = "C:\\Users\\steinr\\ImageJ\\Files\\";
> call("ij.plugin.frame.Editor.setDefaultDirectory", dir);
> call("ij.io.OpenDialog.setDefaultDirectory", dir); //saveAs path for
> both Text windows and images are now set to the desired directory
>
> Can this be fixed, or is it a limitation of Java / Windows?

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

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