Re: Fiji grabs focus during long scripts

Posted by Aryeh Weiss on
URL: http://imagej.273.s1.nabble.com/Fiji-grabs-focus-during-long-scripts-tp5023556p5023560.html

Hi Jan

Again thank you for your quick reply.

On 22/06/2020 18:30, Jan Eglinger wrote:

> Hi Aryeh,
>
> I'd recommend using 'setBatchMode(true)' in macros whenever possible
> to prevent new windows from being opened.
>
> Other than that, you can use any other supported scripting language
> (e.g. Groovy or Jython) to interact directly with the Java API of
> plugins, and work with objects headlessly instead of having to rely on
> the active image window.
>
I usually program in Jython. However, this problem occurs there also, I
assume that the trouble there occurs when I am using the IJ.run method,
since that opens image windows. I try to use the API calls, but
sometimes I use a  plugin that is much easier to run using IJ.run.

I found that when using the IJ.run method, is is often necessary to
first display an image (ie, to use the imp.show() method) before running
the command in IJ.run. I assume this happens for methods where the
ImagePlus is not passed as an argument, and they ge the image from teh
open and active ImageWindow.

Best regards

--aryeh


> Cheers
> Jan
>
>
> On 22.06.20 16:20, Aryeh Weiss wrote:
>> When I am running a script that takes some time, I do other things
>> like deal with email, use a text editor or LaTeX, etc. the problem is
>> that during the script, Fiji often grabs focus  ( presumably when it
>> displays an image window, or maybe also when it displays any window).
>> When this happens, whatever I have been typing  is picked up by Fiji
>> as shortcut keys, and it usually messes up whatever is running.
>>
>> Can this behavior be prevented? Is there a way to prevent ImageJ form
>> grabbing focus during execution of a script?
>>
>> Tnx in advance
>> --aryeh
>>

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

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