installing macro properly?

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

installing macro properly?

Kenneth Sloan-2
I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.

I have a file, "foo_macro.ijm" which looks like:

macro "foo_macro" { ...stuff... }

My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:

Plugins>category,"pretty name",className

where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and
"className" is the name of the Java Class.

I want to do something similar with this macro, but...

drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor
so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.

That works about as expected, except:

a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
    I would like to put it in plugins/subFolder.
b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.

Following the documentation, I tried:

macro "<subMenu> foo_macro" { ...stuff... }

but this had no effect.

What am I doing wrong?  

I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).  

I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.

My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.

Clues?

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Michael Schmid
Hi Kenneth,

this works for me:

Installing the following macro

   macro "<test> foo_macro" { print("test foo"); }
   macro "<test> bar_macro" { print("test bar"); }

creates a Plugins>Macros>test submenu, with entries "foo_macro" and
"bar_macro".

If you want to have it directly in Plugins>... submenus, put the macro
file into the coresponding subdirectory of ImageJ/plugins and make sure
the file name contains an underscore. It should appear in the menu after
you restart ImageJ or after Help>Refresh Menus. I guess that only one
level of subdirectories ImageJ/plugins/... is allowed.

Michael
________________________________________________________________
On 10.06.20 18:57, Kenneth Sloan wrote:

> I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.
>
> I have a file, "foo_macro.ijm" which looks like:
>
> macro "foo_macro" { ...stuff... }
>
> My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:
>
> Plugins>category,"pretty name",className
>
> where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and
> "className" is the name of the Java Class.
>
> I want to do something similar with this macro, but...
>
> drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor
> so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.
>
> That works about as expected, except:
>
> a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
>      I would like to put it in plugins/subFolder.
> b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.
>
> Following the documentation, I tried:
>
> macro "<subMenu> foo_macro" { ...stuff... }
>
> but this had no effect.
>
> What am I doing wrong?
>
> I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).
>
> I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.
>
> My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.
>
> Clues?
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Herbie
In reply to this post by Kenneth Sloan-2
Good day Kenneth!

Many words...

ImageJ-1 style:

1.
Usually macros should reside in the folder named "macros" of your
ImageJ-1 installation. I think this follows a certain logic.

2.
If you prefer to see your macros in the subfolder "macros" of the
plugins folder of your ImageJ-1 installation, then just put it there and
make sure that the macro name has an underscore. The macro will then
appear in the Plugins-menu of ImageJ-1 in a submenu named "macros".

I have no good recommendation for the installation, if you don't want to
drop the macro-file in the dedicated folders.

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 10.06.20 um 18:57 schrieb Kenneth Sloan:

> I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.
>
> I have a file, "foo_macro.ijm" which looks like:
>
> macro "foo_macro" { ...stuff... }
>
> My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:
>
> Plugins>category,"pretty name",className
>
> where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and
> "className" is the name of the Java Class.
>
> I want to do something similar with this macro, but...
>
> drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor
> so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.
>
> That works about as expected, except:
>
> a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
>      I would like to put it in plugins/subFolder.
> b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.
>
> Following the documentation, I tried:
>
> macro "<subMenu> foo_macro" { ...stuff... }
>
> but this had no effect.
>
> What am I doing wrong?
>
> I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).
>
> I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.
>
> My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.
>
> Clues?
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Wayne Rasband-2
In reply to this post by Kenneth Sloan-2
> On Jun 10, 2020, at 12:57 PM, Kenneth Sloan <[hidden email]> wrote:
>
> I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.
>
> I have a file, "foo_macro.ijm" which looks like:
>
> macro "foo_macro" { ...stuff… }

Use the Plugins>Install... command to install the macro. It will display two dialogs. In the first, select the macro you want to install. In the second, select the folder in the plugins folder where you want to install the macro. This works with both ImageJ and Fiji, but with Fiji, the macro must have an underscore in the name, you have to restart before the macro appears in the Plugins menu, and the macro is not installed if you create a sub-folder in the second dialog.

-wayne

> My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:
>
> Plugins>category,"pretty name",className
>
> where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and
> "className" is the name of the Java Class.
>
> I want to do something similar with this macro, but...
>
> drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor
> so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.
>
> That works about as expected, except:
>
> a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
>    I would like to put it in plugins/subFolder.
> b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.
>
> Following the documentation, I tried:
>
> macro "<subMenu> foo_macro" { ...stuff... }
>
> but this had no effect.
>
> What am I doing wrong?  
>
> I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).  
>
> I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.
>
> My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.
>
> Clues?

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Herbie
Thanks Wayne,

for pointing this out.

For logical reasons (Macros) I had only a look at
        "Plugins >> Macros >> Install..."
but this does not what Kenneth was looking for.

Perhaps the latter menu item should / could be removed.
Although a macro can be installed, all previously installed macros are
removed which is annoying, at least for me.

Kind regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 10.06.20 um 20:02 schrieb Wayne Rasband:

>> On Jun 10, 2020, at 12:57 PM, Kenneth Sloan <[hidden email]> wrote:
>>
>> I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.
>>
>> I have a file, "foo_macro.ijm" which looks like:
>>
>> macro "foo_macro" { ...stuff… }
>
> Use the Plugins>Install... command to install the macro. It will display two dialogs. In the first, select the macro you want to install. In the second, select the folder in the plugins folder where you want to install the macro. This works with both ImageJ and Fiji, but with Fiji, the macro must have an underscore in the name, you have to restart before the macro appears in the Plugins menu, and the macro is not installed if you create a sub-folder in the second dialog.
>
> -wayne
>
>> My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:
>>
>> Plugins>category,"pretty name",className
>>
>> where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and
>> "className" is the name of the Java Class.
>>
>> I want to do something similar with this macro, but...
>>
>> drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor
>> so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.
>>
>> That works about as expected, except:
>>
>> a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
>>     I would like to put it in plugins/subFolder.
>> b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.
>>
>> Following the documentation, I tried:
>>
>> macro "<subMenu> foo_macro" { ...stuff... }
>>
>> but this had no effect.
>>
>> What am I doing wrong?
>>
>> I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).
>>
>> I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.
>>
>> My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.
>>
>> Clues?
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Stein Rørvik
In reply to this post by Kenneth Sloan-2
What I do is that I create a sub-folder of the plugins folder and just put the macros there. Then the macros will appear in the corresponding sub-folder of the plugins-menu. The name does not need to contain an underscore, and the macro will appear in the menu without the .ijm extension. I think this is easier and gives more control than using the Install... command. I have honestly never understood the purpose of the Install.. command as it appear confusing to me; installing what, where?

Please notice that you can have the folder only one level deep, a sub-folder of a sub-folder will not show up in the menus.

Stein

-----Original Message-----
Sent: 10. juni 2020 18:57
To: [hidden email]
Subject: installing macro properly?

I apologize for being slow - but the documentation is confusing me.  So, I'll pester you with a direct question about my specific problem.

I have a file, "foo_macro.ijm" which looks like:

macro "foo_macro" { ...stuff... }

My usual routine with Java plugins is to use a "plugins.config" file in the .jar file.  Typically, I drag&drop the .jar file, select a subfolder under plugins (to keep all my plugins in one place - mostly so it is easy to DELETE all of them when required), and restart FIJI.  Works perfectly.  The plugins.config file always looks like this:

Plugins>category,"pretty name",className

where "category" is a sub-menu under Plugins where I want "pretty name" to appear, and "className" is the name of the Java Class.

I want to do something similar with this macro, but...

drag&drop of foo_macro.ijm does not install the macro - instead it brings me into the editor so, OK - I'll use Plugins>Install Plugin.  Note that I have rarely used this method, so I may completely mis-understand it.

That works about as expected, except:

a) there seems to be no way to select a subfolder of plugins - foo_macro.ijm is installed in plugins.
    I would like to put it in plugins/subFolder.
b) I can't seem to get the macro to show up with a sub-menu - it shows up at the bottom, along with Debug and Sandbox and others.  I would like it to show up as Plugins>subMenu>foo_macro.

Following the documentation, I tried:

macro "<subMenu> foo_macro" { ...stuff... }

but this had no effect.

What am I doing wrong?  

I think I can install the macro manually in a sub-folder (but I don't like to do that myself, and I definitely don't want to tell my colleagues to try to do this themselves).  

I have no clue how to get the macro to show up as Plugins>subMenu>foo_macro.

My main sources so far have been the online tutorial and the example macro "MacroSubMenus.txt" - but clearly I'm not understanding them.

Clues?

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Kenneth Sloan-2
In reply to this post by Herbie
Wayne-

Thanks for the prompt reply.

I am using FIJI, and tried your suggestion to use Install instead of Install Plugin.

That seemed to work as you described, but also (as I think you described), the plugin is not visible in any menu.

Is this a limitation for FIJI?  If so, I suppose I can live with it, but I really did like keeping all of my plugins in a separate plugins/subFolder.

Using Install... and putting foo_macro.ijm in plugins, the macro is installed, and works - but it still shows up at the bottom of the Plugins menu. So, it is accessible as:

Plugins>foo_macro

Is there any way to make it appear in the menu as:

Plugins>subMenu>foo_macro?

The macro is written (as demonstrated by the example macro) as:

macro "<subMenu> foo_macro" { ... stuff ... }

but the <subMenu> seems to have zero effect.

Is this another difference between ImageJ and FIJI?

Is there another mechanism I can use to create Plugins>subMenu and install macros so they appear there?

I realize that this is largely cosmetic, but I'm trying to understand how this all works.  Both the location of the macro (in a separate plugins/subFolder) and the appearance on the menu (at Plugins>subMenu) are things I would *like* to do - but neither are critical.

Recall that my standard practice in the past was to install .jar files containing both Java classes and a "plugins.config" file.  That's the only mechanism I currently understand for manipulating the appearance of the menu structure.  Is there particular piece of documentation (for either ImageJ or FIJI - but FIJI is what we are using) which explains this?

Hmmm...would it work to package foo_macro.ijm and a plugins.config file in a .jar file and try to install *that*?  Would this work in FIJI, if the .jar file were in plugins>subFolder?  Is there some *other* recommended place to install macros so that access to them looks just like access to Java plugins?

Of course, if push came to shove, I could just take the macro and rewrite it in Java.  Perhaps that would be easier, all around.  
 
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Herbie
Kenneth,

thanks for referring to my reply. As you may have realized, Fiji follows
  a slightly different scheme than ImageJ.

If you use "Plugins >> Install...", the installed macro is accessible
from "Plugins >> Macros" which is not what you want.

If you use "Plugins >> Install Plugin..." the installed macro is
accessible from the "Plugins"-menu but not from a submenu thereof.

That's how it is and it is up to you to propose altered source code
either to Wayne or the maintainers of Fiji. But, to be honest, is it
really such important?

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 10.06.20 um 21:41 schrieb Kenneth Sloan:

> Wayne-
>
> Thanks for the prompt reply.
>
> I am using FIJI, and tried your suggestion to use Install instead of Install Plugin.
>
> That seemed to work as you described, but also (as I think you described), the plugin is not visible in any menu.
>
> Is this a limitation for FIJI?  If so, I suppose I can live with it, but I really did like keeping all of my plugins in a separate plugins/subFolder.
>
> Using Install... and putting foo_macro.ijm in plugins, the macro is installed, and works - but it still shows up at the bottom of the Plugins menu. So, it is accessible as:
>
> Plugins>foo_macro
>
> Is there any way to make it appear in the menu as:
>
> Plugins>subMenu>foo_macro?
>
> The macro is written (as demonstrated by the example macro) as:
>
> macro "<subMenu> foo_macro" { ... stuff ... }
>
> but the <subMenu> seems to have zero effect.
>
> Is this another difference between ImageJ and FIJI?
>
> Is there another mechanism I can use to create Plugins>subMenu and install macros so they appear there?
>
> I realize that this is largely cosmetic, but I'm trying to understand how this all works.  Both the location of the macro (in a separate plugins/subFolder) and the appearance on the menu (at Plugins>subMenu) are things I would *like* to do - but neither are critical.
>
> Recall that my standard practice in the past was to install .jar files containing both Java classes and a "plugins.config" file.  That's the only mechanism I currently understand for manipulating the appearance of the menu structure.  Is there particular piece of documentation (for either ImageJ or FIJI - but FIJI is what we are using) which explains this?
>
> Hmmm...would it work to package foo_macro.ijm and a plugins.config file in a .jar file and try to install *that*?  Would this work in FIJI, if the .jar file were in plugins>subFolder?  Is there some *other* recommended place to install macros so that access to them looks just like access to Java plugins?
>
> Of course, if push came to shove, I could just take the macro and rewrite it in Java.  Perhaps that would be easier, all around.
>  
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Kenneth Sloan-2
Herbie-

That's not how is works in my FIJI installation.

As previously reported, I used Plugins>Install... and the macro appears at the bottom of the Plugins menu.  Now...this is below a horizontal line, and perhaps everything below that line is a macro - but I do not see the macro listed under Plugins>Macros.


--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Herbie
Sure Kenneth, that's what I wrote:

If you use "Plugins >> Install Plugin..." the installed macro is
accessible from the "Plugins"-menu but *not* from a submenu thereof.
(Emphasis now added.)

In short, what you like to obtain isn't supported, neither by a
menu-command in ImageJ nor in Fiji.

To install a macro in "Plugins >> Macros" (at the *top* of the menu) you
need to use "Plugins >> Install..." but I understand that you like to
see your macro installed in a submenu of the Plugins-list and I see *no*
way to do this by the available menu commands. It is possible however by
dropping the macro in a corresponding folder.

I accept that certain naming conventions are suboptimum, but I'm not
responsible for them and they may have evolved because of backwards
compatibility.

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 10.06.20 um 22:52 schrieb Kenneth Sloan:

> Herbie-
>
> That's not how is works in my FIJI installation.
>
> As previously reported, I used Plugins>Install... and the macro appears at the bottom of the Plugins menu.  Now...this is below a horizontal line, and perhaps everything below that line is a macro - but I do not see the macro listed under Plugins>Macros.
>
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Curtis Rueden-2
In reply to this post by Kenneth Sloan-2
Hi all,

Kenneth Sloan wrote:
> I really did like keeping all of my plugins in a separate
plugins/subFolder.

ImageJ2 (and therefore Fiji) lets you put macros and scripts wherever you
want in the menus, including nested submenus. Just place your scripts in a
subfolder of scripts/. (For backwards compatibility with previous behavior,
it also works to use plugins/Scripts/ or plugins/, although I would not
recommend doing this.)

Alternately, you can embed them into a JAR file at a path like
/scripts/Toplevel_Menu>/Optional_Submenu/Optional_Nested_Submenus_Etc/My_Script.js,
with the JAR file itself living in the jars/ directory as usual. Here is an
example embedded script:

https://github.com/imagej/imagej-legacy/blob/imagej-legacy-0.37.4/src/main/resources/scripts/Image/Adjust/Manual_Threshold....js

Use a file extension matching one of the supported script languages; for
ImageJ macros, that is .ijm.

Wayne Rasband wrote:
> with Fiji, the macro must have an underscore in the name

To test this, I created the following files in my local Fiji installation:
  ./scripts/Foo/Bar_Bar.ijm
  ./scripts/Foo/Bar.ijm
  ./plugins/Scripts/Foo2/Bar2_Bar2.ijm
  ./plugins/Scripts/Foo2/Bar2.ijm
  ./plugins/Foo3/Bar3.ijm
  ./plugins/Foo3/Bar3_Bar3.ijm

When I type 'bar' into the search bar, all six items appear as entries.
However, only the three items with underscores actually appear in the
menus, at the following locations:
  ./scripts/Foo/Bar_Bar.ijm -> Foo > Bar Bar
  ./plugins/Scripts/Foo2/Bar2_Bar2.ijm -> Foo2 > Bar2 Bar2
  ./plugins/Foo3/Bar3_Bar3.ijm -> Plugins > Foo3 > Bar3 Bar3

The reason that scripts without underscores are not included is due to this
line of code:

https://github.com/imagej/imagej-legacy/blob/imagej-legacy-0.37.4/src/main/java/net/imagej/legacy/LegacyService.java#L682

Which was added in this commit:

https://github.com/imagej/imagej-legacy/commit/1edf9f4ca4f58a080f1a783da998ef0818ecbd86

In response to this bug report:
  https://fiji.sc/bug/804.html

I'm sure there is a more elegant solution to avoid spurious script entries
while still allowing valid scripts without underscores to be discovered,
but I don't have time to think about it right now. Pull requests are
welcome (as long as they are well tested!).

Regards,
Curtis

--
Curtis Rueden
Software architect, LOCI/Eliceiri lab - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Have you tried the Image.sc Forum? https://forum.image.sc/



On Wed, Jun 10, 2020 at 2:43 PM Kenneth Sloan <[hidden email]>
wrote:

> Wayne-
>
> Thanks for the prompt reply.
>
> I am using FIJI, and tried your suggestion to use Install instead of
> Install Plugin.
>
> That seemed to work as you described, but also (as I think you described),
> the plugin is not visible in any menu.
>
> Is this a limitation for FIJI?  If so, I suppose I can live with it, but I
> really did like keeping all of my plugins in a separate plugins/subFolder.
>
> Using Install... and putting foo_macro.ijm in plugins, the macro is
> installed, and works - but it still shows up at the bottom of the Plugins
> menu. So, it is accessible as:
>
> Plugins>foo_macro
>
> Is there any way to make it appear in the menu as:
>
> Plugins>subMenu>foo_macro?
>
> The macro is written (as demonstrated by the example macro) as:
>
> macro "<subMenu> foo_macro" { ... stuff ... }
>
> but the <subMenu> seems to have zero effect.
>
> Is this another difference between ImageJ and FIJI?
>
> Is there another mechanism I can use to create Plugins>subMenu and install
> macros so they appear there?
>
> I realize that this is largely cosmetic, but I'm trying to understand how
> this all works.  Both the location of the macro (in a separate
> plugins/subFolder) and the appearance on the menu (at Plugins>subMenu) are
> things I would *like* to do - but neither are critical.
>
> Recall that my standard practice in the past was to install .jar files
> containing both Java classes and a "plugins.config" file.  That's the only
> mechanism I currently understand for manipulating the appearance of the
> menu structure.  Is there particular piece of documentation (for either
> ImageJ or FIJI - but FIJI is what we are using) which explains this?
>
> Hmmm...would it work to package foo_macro.ijm and a plugins.config file in
> a .jar file and try to install *that*?  Would this work in FIJI, if the
> .jar file were in plugins>subFolder?  Is there some *other* recommended
> place to install macros so that access to them looks just like access to
> Java plugins?
>
> Of course, if push came to shove, I could just take the macro and rewrite
> it in Java.  Perhaps that would be easier, all around.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Wayne Rasband-2
In reply to this post by Kenneth Sloan-2
> On Jun 10, 2020, at 3:41 PM, Kenneth Sloan <[hidden email]> wrote:
>
> Wayne-
>
> Thanks for the prompt reply.
>
> I am using FIJI, and tried your suggestion to use Install instead of Install Plugin.
>
> That seemed to work as you described, but also (as I think you described), the plugin is not visible in any menu.

I did some more testing using Fiji and found if I use Plugins>Install… to install a macro in Plugins/Macros it does appear in the Plugins menu. I can, however, run the macro by entering its name in the search box and pressing return. I also found that if, in the second dialog, I click on “Create Folder” and create a “MyMacros” folder, my macro appears in the Plugins>MyMacros menu. Unexpectedly, “MyMacros” is listed near the bottom of the Plugins menu.

-wayne

>
> Is this a limitation for FIJI?  If so, I suppose I can live with it, but I really did like keeping all of my plugins in a separate plugins/subFolder.
>
> Using Install... and putting foo_macro.ijm in plugins, the macro is installed, and works - but it still shows up at the bottom of the Plugins menu. So, it is accessible as:
>
> Plugins>foo_macro
>
> Is there any way to make it appear in the menu as:
>
> Plugins>subMenu>foo_macro?
>
> The macro is written (as demonstrated by the example macro) as:
>
> macro "<subMenu> foo_macro" { ... stuff ... }
>
> but the <subMenu> seems to have zero effect.
>
> Is this another difference between ImageJ and FIJI?
>
> Is there another mechanism I can use to create Plugins>subMenu and install macros so they appear there?
>
> I realize that this is largely cosmetic, but I'm trying to understand how this all works.  Both the location of the macro (in a separate plugins/subFolder) and the appearance on the menu (at Plugins>subMenu) are things I would *like* to do - but neither are critical.
>
> Recall that my standard practice in the past was to install .jar files containing both Java classes and a "plugins.config" file.  That's the only mechanism I currently understand for manipulating the appearance of the menu structure.  Is there particular piece of documentation (for either ImageJ or FIJI - but FIJI is what we are using) which explains this?
>
> Hmmm...would it work to package foo_macro.ijm and a plugins.config file in a .jar file and try to install *that*?  Would this work in FIJI, if the .jar file were in plugins>subFolder?  Is there some *other* recommended place to install macros so that access to them looks just like access to Java plugins?
>
> Of course, if push came to shove, I could just take the macro and rewrite it in Java.  Perhaps that would be easier, all around.  
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Kenneth Sloan-2
Wayne-

Thank you for testing.  I will do some work on this tomorrow.

My take so far is:

a) putting .jar files in plugins/myStuff, with a plugins.config file puts the plugin
   in the Plugins sub menu specified in the plugins.config file (and plugins/myStuff is irrelevant)
b) putting foo_macro.ijm files in plugins/Macros/myStuff causes the macro to appear as Plugins>myStuff (this is probably what I want

Alas, I have been using subFolders under plugins to organize the plugins for my own maintenance convenience (and using plugins.config files in each .jar file  to control where the plugin appears in the menu structure).  Now, it appears that the folder structure  within plugins/Macros actually controls the menu structure.  I suppose I can live with this - but it seems wildly inconsistent.

c) the example macros, showing how to affect the menu structure with "<subMenuName>" in the macro statement is "no longer operative".  This is where I went wrong in reading the documentation.

d) somehow, plugins/Scripts seems to be preferred  for FIJI, and (I think) I should be installing  foo_macro.ijm in plugins/Scripts/subMenuName.   I'll try that, too.

So...tomorrow will be devoted to double checking all of this and deciding how to proceed.

Thanks to all who replied (especially Wayne, whose replies have been, as usual, accurate and helpful).

I'm OK with telling my colleagues how to use the plugins>Install... dialogs to put things in the right place.  I'm not a fan of asking them to directly manipulate the plugins directory, esp. on machines where they may not have the appropriate privileges.

I'm also mildly unhappy that the end user needs to know if the item being installed is a macro or a plugin - and different techniques are needed to achieve the same effect in the displayed menu structure.

On balance, I guess I would prefer that all plugins appear in the menu structure according to where they are stored under plugins (instead of using plugins.config files) - so I'm not unhappy about how ImageJ2  does this with macros - I suppose I just wish it were all more consistent.

Also - if the <submenu> notation in the macro statement no longer works, I wish that the documentation SAID this more clearly.

But...it is what it is...and I remain grateful for your assistance.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: installing macro properly?

Herbie
Good day Kenneth,

I suffer with you.

Confronted with the same situation as you some while ago, I wrote a
"help.html"-file that explains one possible way to install a plugin
*and* a macro.

Even if the way I recommend the installation isn't yours, it may help to
design a html-doc that can help your users.

Here is the link to my "help.html"-file:
<https://www.gluender.de/Miscellanea/MiscTexts/InstallationHelp/Fiji-Install_EF.html>

Regards

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 11.06.20 um 04:17 schrieb Kenneth Sloan:

> Wayne-
>
> Thank you for testing.  I will do some work on this tomorrow.
>
> My take so far is:
>
> a) putting .jar files in plugins/myStuff, with a plugins.config file puts the plugin
>     in the Plugins sub menu specified in the plugins.config file (and plugins/myStuff is irrelevant)
> b) putting foo_macro.ijm files in plugins/Macros/myStuff causes the macro to appear as Plugins>myStuff (this is probably what I want
>
> Alas, I have been using subFolders under plugins to organize the plugins for my own maintenance convenience (and using plugins.config files in each .jar file  to control where the plugin appears in the menu structure).  Now, it appears that the folder structure  within plugins/Macros actually controls the menu structure.  I suppose I can live with this - but it seems wildly inconsistent.
>
> c) the example macros, showing how to affect the menu structure with "<subMenuName>" in the macro statement is "no longer operative".  This is where I went wrong in reading the documentation.
>
> d) somehow, plugins/Scripts seems to be preferred  for FIJI, and (I think) I should be installing  foo_macro.ijm in plugins/Scripts/subMenuName.   I'll try that, too.
>
> So...tomorrow will be devoted to double checking all of this and deciding how to proceed.
>
> Thanks to all who replied (especially Wayne, whose replies have been, as usual, accurate and helpful).
>
> I'm OK with telling my colleagues how to use the plugins>Install... dialogs to put things in the right place.  I'm not a fan of asking them to directly manipulate the plugins directory, esp. on machines where they may not have the appropriate privileges.
>
> I'm also mildly unhappy that the end user needs to know if the item being installed is a macro or a plugin - and different techniques are needed to achieve the same effect in the displayed menu structure.
>
> On balance, I guess I would prefer that all plugins appear in the menu structure according to where they are stored under plugins (instead of using plugins.config files) - so I'm not unhappy about how ImageJ2  does this with macros - I suppose I just wish it were all more consistent.
>
> Also - if the <submenu> notation in the macro statement no longer works, I wish that the documentation SAID this more clearly.
>
> But...it is what it is...and I remain grateful for your assistance.
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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