Issues with RoiManager open ROIset.zip

In writing a macro to open up an ROIset I am getting an error “java.io.FileNotFoundException: (The system cannot find the file specified)”

Both the image and ROIset are labelled the same with different extensions (e.g. image1.tif & image1.zip). When I execute the macro (below), the error message will be “java.io.FileNotFoundException: 0image1.zip (The system cannot find the file specified)”.

//open ROIset
input=(getDirectory("image"));
id=File.nameWithoutExtension;
roiManager("open", input + id + ".zip");

The issue in the error message is the 0 added before the file name, and I don’t know why it’s there or how I can work around it.

Thanks,
Andrew

Welcome to the forum! :slight_smile:

The problem is this line:

input=(getDirectory("image"));

The extra parentheses confuse the macro language into thinking it’s a function call, I suspect, with a default(?) return value of 0.

Without the extra parens it works for me:

input=getDirectory("image");
1 Like

Thank you for the quick reply. Issue solved.

2 Likes