Re: Macro dialog prefs?

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Macro-dialog-prefs-tp3688182p3688183.html

Hi Chris,

you can save macro options in the prefs, but it is not obvious - you  
have to use the 'call' macro command to directly access the static  
methods of ij.Prefs.


E.g., for an integer number:
   captureTime = parseInt(call("ij.Prefs.get",  
"captureTool.captureTime","2"));
   Dialog.create("Capture Options");
   Dialog.addNumber("Capture Time", captureTime,0,6,"seconds");
   Dialog.show();
   captureTime = round(Dialog.getNumber());
   call("ij.Prefs.set", "captureTool.captureTime",toString
(captureTime));

(This example is from the Video Capture macro, http://
rsb.info.nih.gov/ij/macros/tools/VideoCaptureTool.txt)

Michael
________________________________________________________________

On 5 May 2010, at 18:38, Chris Nicolai wrote:

> Hi,
>
> Is there any way to remember what the user has entered in a macro  
> Dialog, so
> it becomes the default next time it's run?  I have done this in  
> plugins
> using ij.Prefs.  Can you access Prefs from a macro?
>
> Thanks,
> Chris Nicolai
> www.qub.buffalo.edu