Login  Register

Re: Running an ImageJ macro in a java plugin

Posted by BenTupper on Nov 13, 2014; 2:09pm
URL: http://imagej.273.s1.nabble.com/Running-an-ImageJ-macro-in-a-java-plugin-tp5010403p5010406.html

On Nov 13, 2014, at 6:57 AM, Avital Steinberg <[hidden email]> wrote:

> Hi,
> I am trying to run an ImageJ macro in a java plugin using IJ.runMacro. I
> would like to understand how to pass the macro a string argument. The
> following code doesn't work:
>
> String simpleMacro =
>    "String greeting = getArgument();"+
>    "print(greeting);";
>
> IJ.runMacro(simpleMacro,"hi");
>
> What am I doing wrong? How can I pass the macro the string argument "hi"
> and get the macro to print it?
>

Hi,

I think that your simpleMacro needs to point to the file where the macro is stored.  That said, it is an interesting idea to construct macros on the fly to run from a script/plugin.  Anyway, the details can be found here...

http://rsb.info.nih.gov/ij/developer/api/ij/IJ.html#runMacro(java.lang.String,%20java.lang.String)


Cheers,
Ben


> Thank you,
> Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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