Posted by
Michael Schmid on
Sep 30, 2009; 10:31am
URL: http://imagej.273.s1.nabble.com/Re-macro-set-in-plugin-folder-possible-tp3690970p3690972.html
Hi Bruno,
what about the following solution:
Three separate macros in the plugins/whatever directory of your choice.
If you have only a few common variables, use the Prefs to share them,
e.g.,
myIntParam = ...;
call("ij.Prefs.set", "myMacroSet. myIntParam",toString(myIntParam));
myIntParam = parseInt(call("ij.Prefs.get", "myMacroSet.
myIntParam","2"));
//"2" is default value
--
If you have many shared parameters, arrays, etc, have three dummy
macros in the directory of your choice. These should only set a
single parameter in the prefs to tell a common macro what to do, and
then call the common macro; again using run("command").
The common macro (wherever it resides) reads the single parameter
form the prefs and then decides which of the three tasks to do.
Michael
________________________________________________________________
On 30 Sep 2009, at 12:03, Bruno Jesus wrote:
> Dear Wayne,
>
> Thanks for the info. The startupmacro solution works fine and that's
> the option that I had already gotten to work. My only problem is that
> I find the place where the macros are shown to be a bit hidden and I
> would like to give them a stand alone menu. For what I understand now
> it is not possible to that with a macro set?
>
> Would converting my macro set to a plugin do the trick? i.e. be able
> to present my macro set in its individual menu?
>
> Thanks for the help,
> Bruno
>
>
> On Tue, Sep 29, 2009 at 3:30 PM, Wayne Rasband <
[hidden email]> wrote:
>>> Hi all,
>>>
>>> I wrote a macro that is actually a macro set (i.e. 3 macros
>>> in sequence). It has to be written as a macro set because I
>>> have some global variables that have to pass between the
>>> individual macros, and if necessary be changed by the
>>> middle macro.
>>>
>>> I've been able to install and run them properly by
>>> replacing the StartUpMacros.txt with my own version, i.e.
>>> the 3 macro show up in the macro section. However, I would
>>> like to place them in a more obvious and dedicated menu.
>>> I've tried putting the macro inside a folder in the plugin
>>> directory but only the first macro in the macro set is
>>> shown. Any idea how can I solve this issue?
>>>
>>> Help will be much appreciated, Bruno
>>
>> Macro sets are always installed into the Macros submenu at the top
>> of the
>> Plugins menu. You can add a macro set to the macros installed in
>> that menu
>> at startup by appending it to StartupMacros.txt. Or copy the macro
>> set to to
>> the ImageJ/macros/toolsets folder and it will be listed in the
>> toolbar's
>> ">>" menu. Select it from the ">>" menu and the macros in it will be
>> installed in the Plugins>Macros menu.
>>
>> -wayne
>>