Login  Register

Re: close window without selecting first

Posted by Michael Doube-2 on Mar 28, 2007; 10:48am
URL: http://imagej.273.s1.nabble.com/close-window-without-selecting-first-tp3699945p3699946.html

Hi Joe

This works for me:

setBatchMode(true);
selectWindow("image2.tif");
run("Close");
setBatchMode(false);

Cheers,

Mike


around your code


Joe Vandergracht wrote:

> I am a long time user of ImageJ but my plug-in programming skills are rudimentary.  I typically
> simply record a macro and convert to plug-in and dabble a bit with the details.
>
> I am trying to close an image window without first selecting it.  Let's say I have two image windows
> open named "image1" and "image2"
>
> If the focus of attention is on image1 and I want to close image2 I do it as follows:
>
> IJ.selectWindow("image2");
> IJ.run("Close");
>
> That works, but I'd prefer to do it in one command so that the focus stays on image1.
>
> I guessed at
>
> IJ.closeWindow("image2") among other things but have not figured it out yet.  Suggestions?
>
> thanks
>
> Joe vanderGracht
>  

--
Michael Doube  BPhil BVSc MRCVS
PhD Student
Dental Institute
Queen Mary, University of London
New Rd
London  E1 1BB
United Kingdom

Phone +44 (0)20 7377 7000 ext 2681