Hi Fred,
which version of ImageJ are you using?
There was a change in 1.54s13 that should avoid deadlocks with
NonBlockingGenericDialogs.
Anyhow, to run a macro from a Java plugin, I would propose
String result = IJ.runMacro(String macro);
or
String result = IJ.runMacro(String macro, String arg);
According to the documantation, the result String is "[aborted]" in case
of an error. See
https://github.com/imagej/ImageJ/blob/master/ij/IJ.java#L153
Michael
________________________________________________________________
On 28.06.26 22:52, Fred Damen wrote:
Greetings,
I write / run a plugin that needs to run a macro, that is generated, on a
ImagePlus:
String macro = ...
IJ.run(tmpimp, "Macro...", "code=[ "+macro+" ] stack");
The problem is if there is a error in the macro a NonblockingGenericDialog
is called and then ImageJ locks up hard; ... cancel and restart.
Is there a way to run a macro on an image from a plugin and if there is an
error to throw an exception instead of invoking a dialog???
Thanks in advance,
Fred
PS: the code snipit that was considered an error was a variable
subtracting a negative constant: v--1
PSS: a side note: leave the "code=" off the arguments and the Macro...
call is silently ignored.
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html