Login  Register

Re: Setting plugin arguments from macros

Posted by Michael Schmid on Apr 22, 2014; 5:16pm
URL: http://imagej.273.s1.nabble.com/Small-Bug-in-Grid-Collection-Stitching-tp5007385p5007393.html

Hi Philippe,

calling plugins, including passing the 'arg' String to them, is handled in
  IJ.runPlugIn(String commandName, String className, String arg)

In a plugin, you can call this method directly.

For calling a plugin with an 'arg' in a macro, without defining it in plugins.conf, you can write a simple plugin that has a static method with three string arguments and passes them to this method.  Then you can use the 'call' macro directive, e.g.

  call("My_Dispatcher_Plugin.dispatchPlugin", "Radial Profile Angle", "Radial_Profile_Angle_Ext", "about");

assuming that My_Dispatcher_Plugin has a method

  public static void dispatchPlugin(String commandName, String className, String arg) {
    IJ.runPlugIn(commandName, className, arg);
  }

The argument passed to the run(arg) method is unrelated to the arguments passed to GenericDialogs.


Michael
________________________________________________________________
On Apr 22, 2014, at 16:09, Philippe CARL wrote:

> Dear all,
> In plugins it is possible to set launching arguments as a String parameter:
> public void run (final String arg) {.....
> And for example in the Radial_Profile_Angle_Ext plugin there are two menu
> entries defined in a plugins.config file that are defining the following
> entries:
> Plugins, "Radial Profile Angle", Radial_Profile_Angle_Ext
> Help>About Plugins, "Radial Profile Angle...",
> Radial_Profile_Angle_Ext("about")
> And thus to run either one or other defined entry from a macro, it is simply
> done:
> Run("Radial Profile Angle");
> or
> Run("Radial Profile Angle...");
> My question: is it possible to directly run a plugin with a launching
> argument without defining it in a plugins.config file similarly to such a
> way:
> Run("Radial Profile Angle", ("about"));
> Or something like this?
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Biophotonique et Pharmacologie
> UMR 7213 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 41 84
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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