Login  Register

Run a macro from a plugin

Posted by Arne Seitz-2 on Sep 17, 2008; 12:09pm
URL: http://imagej.273.s1.nabble.com/Run-a-macro-from-a-plugin-tp3695057.html

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