Login  Register

Re: spaces in filenames

Posted by Gabriel Lapointe on Jun 09, 2009; 3:25pm
URL: http://imagej.273.s1.nabble.com/spaces-in-filenames-tp3692208p3692212.html

Hello Jon,
I think you just need to put bracket around you file name.

run("Raw...", "open=[" + path + "] image=[16-bit Unsigned] width=" +
width + " height=" + height +" offset=0 number=1 gap=0 little-endian");

Gabriel Lapointe

Jon Harman wrote:

> Hi,
>
> I have a macro that opens a raw data file.  It gets the path:
> path = File.openDialog("Select an image (16 bit raw)");
>
> then uses the raw import to read the file:
> run("Raw...", "open=" + path + " image=[16-bit Unsigned] width=" +
> width + " height=" + height +" offset=0 number=1 gap=0 little-endian");
>
> My problem is that spaces in the filename cause the raw import to fail.
> I have tried replacing them with "%20" and "\ ", neither works.
>
> Can anyone suggest a solution?
>
> Jon
>