Posted by
jumpfunky on
Jan 24, 2014; 5:37pm
URL: http://imagej.273.s1.nabble.com/User-input-for-a-global-variable-in-a-macro-tp3694344p5006268.html
Hi!
I've done this by writing all settings in a string seperated by
";" ("value1;value2;...;valueN") and then writing it to a file
(File.saveString(...)) in the ij temp directory.
When I start the macro I restore the old values out of that file:
oldsettingsRAW
=File.openAsString(getDirectory("temp")+"mysettings.txt");
roidata = split(roidataRaw, ";");
value1 = parseInt(roidata[0]);
value2 = parseInt(roidata[1]);;
etc.
Cheers,
Thorsten
Am Freitag, den 24.01.2014, 09:23 -0800 schrieb mmettlen:
> Related to this, I have a macro using:
>
> Dialog.create("Intensity values");
> Dialog.addNumber("C1min:", 2);
> Dialog.addNumber("C1max:", 10);
> Dialog.addNumber("C2min:", 2);
> Dialog.addNumber("C2max:", 10);
> ...
> Dialog.show();
>
> a = Dialog.getNumber();
> b = Dialog.getNumber();
> c = Dialog.getNumber();
> d = Dialog.getNumber();
> ....
>
> As shown, each time I run the macro, the default values '2' and '10' are
> shown in the dialog box. Is there any way that the macro, when it runs the
> next time, replaces/recalls these values with the last user input (i.e. a,
> b, c, d, ....)?
>
> Thx, Marcel
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/User-input-for-a-global-variable-in-a-macro-tp3694344p5006267.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html