Login  Register

Re: Within my macro, how do I test if a plugin is installed before calling it?

Posted by Wayne Rasband on Aug 07, 2009; 3:15pm
URL: http://imagej.273.s1.nabble.com/Within-my-macro-how-do-I-test-if-a-plugin-is-installed-before-calling-it-tp3691533p3691534.html

On Aug 7, 2009, at 7:33 AM, Alan Hewat wrote:

> I am writing a macro to capture images from a number of different
> cameras,
> correct them for lens distortion, and stitch them together to form a
> mosaic.
>
> I would like to test if a plugin is installed before calling it with
> run("PluginName",...) If I call it without testing if it exists, and
> it is
> not installed I get an ImageJ alert "Unrecognized command: PluginName".

You can test to see if a plugin is installed using

    List.setCommands;
    if (List.get("PluginName")!="") {
       // plugin is installed
    }

This requires the v1.43f daily build, which adds the List.setCommands
macro function.

-wayne