Some issues about when using macros script

I am new to imageJ, when using macro I encountered the following issues,

  1. Macros can not run file path string with “space” character, the string is in the macro code.
  2. I use ImageJ’s Macro to automatically open multiple text image(csv format) pictures, some pictures are displayed abnormally after zoom in.

    Zoom in by 200%, most pictures can fill the window, and individual pictures can be magnified, but it seems that the starting point is not at the center of the image, but at the zero point, which leads to the inability to display the full scale. The macro script is generated using python and ImageJ is updated to 1.53h.

I don’t know what is the problem or a bug, does anyone have a suitable solution?

Thanks for your help.

  1. HELP! with creating a macro with generic file names - #2 by NicoDF

I don’t really understand 2. If you want to help others help you, though, it would help to include the code “as code” - not a picture of the code. Then they do not have to retype everything on their own time to help you!
If your images are not guaranteed to be square, getting only the width might be an issue.

The script code:

v = newArray("*file path*", ... ,"*file path*");
for(i=0; i<v.length; i++){
    string = "open=" + v[i];
    run("Text Image... ", string);
    setMinAndMax(0, 1023);
    width = getWidth();
    run("Set... ", "zoom=400 x=" + width / 2 + " y=" + width / 2);
    setLocation(500, 0);

Fill in the text image path address in " ".

About 2. the image cannot be displayed in full window after zoom in, when I minimize the picture which only displayed in the center of window, and open it again, the picture fills the window normally.