Login  Register

Can I save an array of preferences ?

Posted by Alan Hewat on Mar 04, 2010; 3:32pm
URL: http://imagej.273.s1.nabble.com/Can-I-save-an-array-of-preferences-tp3689120.html

Is it possible to save an array of preferences ? eg can I do:

for (i=0; i<nDevices; i++)  call("ij.Prefs.set", "captureTool.ifCapture[i]
",ifCapture[i]);

Apparently not in version 1.43q because what is saved (silently) in
IJ_Prefs.txt is:

.captureTool.ifCapture[i]\ =1

What does work is:

 for (i=0; i<nDevices; i++)  call("ij.Prefs.set",
"captureTool.ifCapture"+i,ifCapture[i]);

which is fine since I can retrieve the preference array with:

for (i=0; i<nDevices; i++)  ifCapture[i] =
call("ij.Prefs.get","captureTool.ifCapture"+i,ifCapture[i]);
______________________________________________
Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE
<[hidden email]> +33.476.98.41.68
       http://www.NeutronOptics.com/hewat
______________________________________________