Posted by
Jan Eglinger on
Dec 17, 2014; 1:41pm
URL: http://imagej.273.s1.nabble.com/Wait-for-MacroRunner-tp5010982p5010985.html
Dear Peter,
> This I have done by using a MacroRunner in MyPlugin, such as:
> ...
> String macroStr = "run(" + cmdStr + "," + argStr +");";
> macro = new MacroRunner(macroStr);
> ...
To run a plugin from within another plugin, you can use
IJ.run(cmdStr, argStr);
(see
http://javadoc.imagej.net/ImageJ1/index.html?ij/IJ.html )
You can record the necessary code for the plugin by running the Macro
recorder (Plugins > Macros > Record...) in Java mode.
Does that help?
Cheers,
Jan
On 17.12.14 12:37, Peter Haub wrote:
> Dear Wayne,
>
> I need to call a plugin via macro call to bypass the user dialogs of the
> plugin.
> This I have done by using a MacroRunner in MyPlugin, such as:
> ...
> String macroStr = "run(" + cmdStr + "," + argStr +");";
> macro = new MacroRunner(macroStr);
> ...
>
> The problem is that MyPlugin has to wait until the macro thread has been
> finished. I managed this by adding a getThread() function into the
> MacroRunner.java. In MyPlugin I can wait for the macro thread e.g. by:
> ...
> t = macro.getThread();
> while (!t.isInterrupted() && t.isAlive()){
> IJ.wait(200);
> }
> ...
>
> My questions are:
> Is there a more simple way to achieve my task (calling a plugin from a
> plugin with an argument string and bypassing user dialogs)?
> If my MacroRunner suggestion is a working option, would it be possible
> to add a getThread() function into the MacroRunner code of a next
> version of ImageJ? (We would like to stay on the official ImageJ code.)
>
> Thanks
> and regards,
>
> Peter
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html