Quantcast

Automatic start of a plugin

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

Automatic start of a plugin

Amelie Marzin
Hi,

I am currently writing a plugin for ImageJ. This plugin is like a toolbar from where I launch some other plugins or macros.
A great functionality would be to automatically launch my plugin when I start ImageJ. Is there a way to do so?

Thanks,

Amélie
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatic start of a plugin

Michael P Ellis
You can use the StartupMacros.txt file to automatically run macro commands when ImageJ launches.

See: http://rsbweb.nih.gov/ij/developer/macro/macros.html

Define a macro AutoRun in this file to launch your plugin MyPlugin

   macro "AutoRun" {
    showMessage("Hi", "Hello");
        run ("MyPlugin");
  }

Hope this helps

-- Michael Ellis
On 31 Mar 2011, at 13:44, Amelie Marzin wrote:

> Hi,
>
> I am currently writing a plugin for ImageJ. This plugin is like a toolbar from where I launch some other plugins or macros.
> A great functionality would be to automatically launch my plugin when I start ImageJ. Is there a way to do so?
>
> Thanks,
>
> Amélie
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatic start of a plugin

Juanjo Vega
That's the way I do it with my plugins.

You'll need to tell ImageJ to start your plugin with the "-macro" parameter. I had some problems because you need to tell it the FULL PATH to your macro, even if it is stored at the macros folder. I mean:

... -macro <IMAGEJ_HOME>/macros/AutoRun.txt

Hope it helps :)

I even managed to pass arguments to my plugins through the macro and from a shell script, it's not hard but a bit tricky, so if you need to do that in the future, just let me know.

Juanjo


On Mar 31, 2011, at 3:05 PM, Michael Ellis wrote:

> You can use the StartupMacros.txt file to automatically run macro commands when ImageJ launches.
>
> See: http://rsbweb.nih.gov/ij/developer/macro/macros.html
>
> Define a macro AutoRun in this file to launch your plugin MyPlugin
>
>   macro "AutoRun" {
>     showMessage("Hi", "Hello");
> run ("MyPlugin");
>  }
>
> Hope this helps
>
> -- Michael Ellis
> On 31 Mar 2011, at 13:44, Amelie Marzin wrote:
>
>> Hi,
>>
>> I am currently writing a plugin for ImageJ. This plugin is like a toolbar from where I launch some other plugins or macros.
>> A great functionality would be to automatically launch my plugin when I start ImageJ. Is there a way to do so?
>>
>> Thanks,
>>
>> Amélie

------------------------------------------------------------
Juanjo Vega ([hidden email])

Unidad de Biocomputación. Laboratorio B-13.
Centro Nacional de Biotecnología. CNB-CSIC.
C\ Darwin, 3. Campus de Cantoblanco.
Universidad Autónoma de Madrid.
28049, Madrid, Spain.

http://www.cnb.csic.es
http://www.biocomp.cnb.csic.es

+34 91 585 4510

"Las mejores almas son capaces de los mayores vicios como de las mayores
virtudes, y aquellos que caminan despacio por el camino recto pueden
llegar más lejos que los que corren pero se apartan de él." - Discurso
del Método, René Descartes.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Automatic start of a plugin

Amelie Marzin
In reply to this post by Michael P Ellis
Thanks a lot! I used Michael tip, it works perfectly (I didn't think about
autorun... ;-) ).

Amélie
Le 31 mars 2011 15:07, "Michael Ellis" <[hidden email]> a écrit :
Loading...