Re: macro set in plugin folder, possible?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: macro set in plugin folder, possible?

Wayne Rasband
 > 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
Reply | Threaded
Open this post in threaded view
|

Re: macro set in plugin folder, possible?

Bruno Jesus-6
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
>
Reply | Threaded
Open this post in threaded view
|

Re: macro set in plugin folder, possible?

Gabriel Landini
On Wednesday 30 September 2009  11:14:19 Bruno Jesus wrote:
> 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?

At the moment I think that we cannot put macros or .js  scripts in the main
menu categories (other than in Plugins), but:
You could put your macros in an Action Bar (search the IJ site).
Or you could separate the macros into single files  and put a "_" in the name
so they appear in the Plugins entries.
Or you could open the Control Panel and run the macros from there.

There might be some other way, not sure if ToolSets (the red >> button) was
mentioned earlier.

Cheers,
G.
Reply | Threaded
Open this post in threaded view
|

Re: macro set in plugin folder, possible?

Michael Schmid
In reply to this post by Bruno Jesus-6
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
>>