Login  Register

Jython scripting to close a notification or warning window

Posted by John-2 on Sep 05, 2019; 7:46pm
URL: http://imagej.273.s1.nabble.com/Jython-scripting-to-close-a-notification-or-warning-window-tp5022417.html

I have a jython script which uses TrakEM2 to register a large series of images. If it encounters a situation where it cannot find matching features, it interrupts the script with a notification. I cannot find a way around this.

First, is there a way to run a script with warnings or notifications completely disabled?

Second, is there a way to dismiss them in the script? Here is a more general example:

If I run the following without an image open, the IJ.getImage() will display a “No Image” error notification, after I manually dismiss it, it will move on to the “except”. I cannot find a way to get either the window manager or the “Close All”  to dismiss the notification. I’ve shuffled them around and no matter where I put them, I still have to manual close the “No Image” error window.

try:
                imp = IJ.getImage()

                IJ.run("Close All") # I've tried this

                w = WindowManager # And I've tried this
                win = w.getWindow("No Image")
                win.removeNotify()
except:
                print "except"

Thanks,
John

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html