ImageJ if statement won't execute roiManager("Select",#); <p>Finally got my code working except for one if statement that I cannot fix. I am selecting ROIs 3 and 4 in the first step, and then if the "if" statement is satisfied I want to select just the 4th ROI and delete that. For whatever reason it skips the selection of ROI 4 and deletes the already selected 3 and 4. I've tried selectWindow("ROI Manager"); before with no luck. Not really sure what the issue is or how to fix. Thanks!</p> <pre><code>roiManager("Select", newArray(3,4)); roiManager("Measure"); tempX1=getResult("X", 0); tempY1=getResult("Y", 0); tempX2=getResult("X", 1); tempY2=getResult("Y", 1); selectWindow("Results"); run("Close"); if (tempX1&gt;(tempX2-2) &amp;&amp; tempX1&lt;(tempX2+2) &amp;&amp; tempY1&gt;(tempY2-2) &amp;&amp; tempY1&lt;(tempY2+2)) { selectWindow("ROI Manager"); roiManager("Select", 4); roiManager("Delete"); } </code></pre>