If I understand your question, in your plugin you can use Recorder.record()
but you need to write your macro command.

Yuekan

On Wed, Apr 29, 2026 at 2:57 PM Gluender <[email protected]> wrote:

> Well Fred,
>
> I agree with your "general understanding", even as a plugin-coder.
>
> 1. "recording / processing is handled under the hood of the GenericDialog"
>
> Yes and no, the Recorder-class is involved as well.
>
> 2. "If the fields of the GenericDialog were passed in using a IJ.run...
> method as parameters the GenericDialog would not display the GUI and
> just return these values by way of the get... methods"
>
> Yes, except that then you actually use a run(...) macro command.
>
> 3. "I have not yet found a tutorial of how Recording / GenericDialog is
> supposed to work together"
>
> Maybe the "Class Recorder"-API helps:
> <https://imagej.net/ij/developer/api/ij/ij/plugin/frame/Recorder.html>
>
> 4. "I have not yet found a tutorial of what the Java plugin writer needs
> to implement by default"
>
>  From my point of view, this is rather straightforward and there are
> many code examples available, e.g. the classic "tutorial 171" by Werner
> Bailer (2006):
> <https://imagej.net/ij/download/docs/tutorial171.pdf>
> (see especially sections 6.1 and 6.2)
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 29.04.26 um 21:26 schrieb Fred Damen:
> > Greetings,
> >
> > Sorry if my request was confusing, but I am looking for the opposite...
> >
> > My general understanding, (from a plugin writers perspective), the
> > recording / processing is handled under the hood of the GenericDialog...
> > If the fields of the GenericDialog were passed in using a IJ.run...
> method
> > as parameters the GenericDialog would not display the GUI and just return
> > these values by way of the get... methods. This is a guess on my part, as
> > I have not yet found a tutorial of how Recording / GenericDialog is
> > supposed to work together, and/or, what the Java plugin writer needs to
> > implement by default, or can override, gotchas, etc...
> >
> > As I tend add panel(s) and/or fetch the values directly from the Java
> > components, this Q/A was very valuable info...
> >
> > Thanks in advance,
> >
> > Fred
> >
> > On Wed, April 29, 2026 12:09 pm, Gluender wrote:
> >> Greetings Fred,
> >>
> >> you need to distinguish between Macro-recording of item-states in a
> >> GenericDialog and that of item-states in individual dialogs.
> >>
> >> AFAIK the "gd.get..."-methods refer to the GenericDialog and are often
> >> called in a dedicated method such as:
> >>
> >>     private void returnParameters( GenericDialog gd ) { ... }
> >>
> >> but they ma also reside at the end of the GenericDialog-code.
> >>
> >> Both leads to automatic Macro-recording.
> >>
> >> Regards
> >>
> >> Herbie
> >>
> >> ::::::::::::::::::::::::::::::::::::::::
> >> Am 29.04.26 um 18:38 schrieb Fred Damen:
> >>> Greetings,
> >>>
> >>> Is there a good tutorial on recording??? Every time I get the urge to
> >>> get
> >>> recording to work for my plugins I can find the parts, e.g. Recorder
> >>> class, but nothing that say this is how it is supposed to work as a
> >>> whole,
> >>> especially the gotchas, n.b. needing to call get... methods????
> >>>
> >>> Thanks in advance,
> >>>
> >>> Fred
> >>>
> >>>
> >>> On Wed, April 29, 2026 10:27 am, Michael Schmid wrote:
> >>>> Hi Herbie,
> >>>>
> >>>> one more thing that comes into my mind:
> >>>>
> >>>> If you never call the "get..." method (such as getNextNumber,
> >>>> getNextString) of a GenericDialog, the component won't be
> >>>> macro-recorded.
> >>>>
> >>>> So you don't necessarily need gd.addPanel, you can add them Component
> >>>> as
> >>>> usual. But you have to retrieve its value without the gd.get... method
> >>>> of the GenericDialog. If you have  dialogListener, also the
> >>>> DialogListner must not call gd.get... for this Component.
> >>>>
> >>>> Roughly like this:
> >>>>
> >>>>      gd.addStringField("Text: ", suggestedText);
> >>>>      Object textField = gd.getStringFields().lastElement();
> >>>>      gd.showDialog();
> >>>>      String theText = ((TextField)textField).getText();
> >>>>      // Do NOT call gd.getNextString() !
> >>>>
> >>>> Nevertheless, you can still set the value of this field in a macro,
> >>>> e.g.
> >>>>      run("My Plugin", "text=abcde");
> >>>> and it will behave as if the user had entered "abcde".
> >>>> Macro recording won't record "text=abcde", however.
> >>>>
> >>>>
> >>>> Michael
> >>>> ________________________________________________________________
> >>>> On 29.04.26 16:46, Gluender wrote:
> >>>>> Dear Michael,
> >>>>>
> >>>>> many thanks for your immediate reply and the suggestion!
> >>>>>
> >>>>> The approach may require some work ("get...", DialogListener) but it
> >>>>> is
> >>>>> doable.
> >>>>>
> >>>>> Thanks for the link as well. As you know, more recently and for other
> >>>>> reasons I had a look at the ij.plugin.HyperStackConverter code.
> >>>>>
> >>>>> Thanks again
> >>>>>
> >>>>> Herbie
> >>>>>
> >>>>> ::::::::::::::::::::::::::::::::::::::::::::
> >>>>> Am 29.04.26 um 16:26 schrieb Michael Schmid:
> >>>>>> Hi Herbie,
> >>>>>>
> >>>>>> in a GenericDialog, you can add a panel with Components that are not
> >>>>>> handled by the GenericDialog itself.
> >>>>>>
> >>>>>> For these items, you can't retrieve the values (or status) with
> >>>>>> GenericDialog methods like gd.getNextNumber(); you have to do it
> with
> >>>>>> the "get..." method of the Component added.
> >>>>>> Also, a DialogListener of the GenericDialog (if any) won't be
> called,
> >>>>>> you have to register the appropriate listener (if required).
> >>>>>>
> >>>>>> An example are the 'auto' checkboxes of Image>Stack>Stack to
> >>>>>> HyperStack; the code is in ij.plugin.HyperStackConverter,
> >>>>>>
> >>>>>>
> https://github.com/imagej/ImageJ/blob/master/ij/plugin/HyperStackConverter.java
> >>>>>> (line 182–282)
> >>>>>>
> >>>>>>
> >>>>>> Michael
> >>>>>> ________________________________________________________________
> >>>>>> On 29.04.26 14:35, Gluender wrote:
> >>>>>>> Dear experts,
> >>>>>>>
> >>>>>>> is it possible (and if yes, how) to _exclude_ certain items of a
> >>>>>>> GenericDialog in a plugin-code from Macro-recording?
> >>>>>>>
> >>>>>>> Any ideas?
> >>>>>>>
> >>>>>>> Regards
> >>>>>>>
> >>>>>>> Herbie
> >>>>>>> :::::::::::::
> >>>>>>
> >>>>>> --
> >>>>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>>>
> >>>> --
> >>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>>>
> >>>
> >>> --
> >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>>
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Reply via email to