Posted by
Stein Rørvik on
Nov 13, 2017; 2:53pm
URL: http://imagej.273.s1.nabble.com/Forward-slashes-do-not-work-for-default-directories-tp5019697.html
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.
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?
Stein
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html