Dear ImageJ users,
I’m trying to write a macro to import raw data where there are both spaces and the special character “]” in the path to the data e.g.
/parent/directory [2018-08-08 14.30.00]/dataFile where the text inside [ ] is the date and time the file was created which is written by some closed source software.
Paths containing “]” can be imported with:
run("Raw...", "open="+sourceDir+File.separator+dataFile+" image=...
where sourceDir=full path to the directory
Paths containing spaces can be imported with:
run("Raw...", "open=["+sourceDir+File.separator+dataFile+"] image=...
There is no problem with both spaces and “]” using the drop-down menu File->Import->Raw…, but when using the macro recorder to turn this command into a IJ1 macro, I cannot find a way to handle both spaces and “]”.
The error returned by the macro is:
Read error or file not found (1): /parent/directory [2018-08-08 14.30.00
with the path to the data file terminating at “]”. This happens both when using variables to define the path to the data file and when using a string.
It would be an option to rename the directory so as not to contain special characters, but I would prefer not to if possible.
Thanks for your help