Re: Modify Log window size and position in a macro?

Posted by Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/Modify-Log-window-size-and-position-in-a-macro-tp3687259p3687260.html

On Aug 14, 2010, at 1:06 PM, Bill Mohler wrote:

> I would like to resize and relocate the Log window in a macro. Is there
> a simple command I'm missing? Or do I need to write and call a little
> plugin?

You can relocate the Log window using the setLocation() macro function:

  if (isOpen("Log")) {
     selectWindow("Log");
     setLocation(10, 50);
  }

To both relocate and resize it you can use the eval() function to run JavaScript code:
 
  script =
    "lw = WindowManager.getFrame('Log');\n"+
    "if (lw!=null) {\n"+
    "   lw.setLocation(10,50);\n"+
    "   lw.setSize(300, 600)\n"+
    "}\n";
  eval("script", script);

-wayne