Posted by
Arne Seitz-2 on
Sep 17, 2008; 12:42pm
URL: http://imagej.273.s1.nabble.com/Run-a-macro-from-a-plugin-tp3695057p3695059.html
Now it works fine!
Thanks for your help Jerome
-----Ursprüngliche Nachricht-----
Von: ImageJ Interest Group [mailto:
[hidden email]] Im Auftrag von
Jerome Mutterer
Gesendet: Mittwoch, 17. September 2008 14:34
An:
[hidden email]
Betreff: Re: Run a macro from a plugin
Arne,
You should use IJ.runMacroFile(java.lang.String name, java.lang.String arg)
IJ.runMacro runs a macro string, not a macro file.
Jerome.
On Wed, Sep 17, 2008 at 2:09 PM, Arne Seitz <
[hidden email]> wrote:
> Dear all,
>
> I'm facing a problem when I want to run a macro from a plugin an passing
an
> argument to it (e.g. the name of the file to open).
>
> Doing this from another macro works pretty well with the following code:
>
> runMacro("path+MacroName","path+ImageName");
>
> My maybe rather naive idea was to do the same thing via the following
plugin:
>
> import ij.IJ;
> import ij.plugin.PlugIn;
>
> public class AMacroTest_ implements PlugIn {
> public void run(String arg) {
> IJ.runMacro("path+MacroName","path+ImageName");
> }
> }
>
> But if I do so I get a "Macro error","Undefined variable in line 1". This
is
> a little bit puzzling for me, because the identical macro is not causing a
> problem when called from a macro.
>
> I appreciate any suggestions how to run a macro from a plugin and passing
> and argument.
>
> Cheers Arne
>
> ___________________________________
> Arne Seitz
> Advanced Light Microscopy Facility
> EMBL Heidelberg
>