Login  Register

Re: "Static" macro variables?

Posted by jmutterer on Oct 27, 2006; 8:50pm
URL: http://imagej.273.s1.nabble.com/Need-a-plugin-to-read-nd2-files-in-ImageJ-tp3701161p3701165.html

Joachim,
you can use the built in preferences file to store values. Take a look
at the callJavaDemo.txt macro, and use :

value  = call("ij.Prefs.get", key, defaultValue);
and
call("ij.Prefs.set", key, value);


Jerome



On 10/27/06, Michael Cammer <[hidden email]> wrote:

> If you set global variables and then don't reload the macro, the
> value from the last run is saved.  For instance:
>
> var a;
> a = getNumber(a,a);
> print (a);
>
> At each run it will remember the value of a from the previous run.
>
>
>
> At 01:43 PM 10/27/06, you wrote:
> >Hi,
> >
> >when programming a plugin I like that I can use statics for any variables
> >that set processing parameters etc.,
> >so the next time I run the same plugin the recent settings are already
> >active (at least within one ImageJ session).
> >
> >This does not work with macros as there are no static variables. Any good
> >suggestions to acchieve this?
> >Saving the settings in a file would be possible, but I find it a bit
> >clumsy.
> >
> >Joachim
> >
> >
> >______________________________________________________________________
> >This email has been scanned by the MessageLabs Email Security System.
> >For more information please visit http://www.messagelabs.com/email
> >______________________________________________________________________
>
> ____________________________________________________________________________
> Michael Cammer   Analytical Imaging Facility   Albert Einstein Coll. of Med.
> URL:  http://www.aecom.yu.edu/aif/
>