Posted by
Michael Schmid on
Mar 04, 2010; 3:55pm
URL: http://imagej.273.s1.nabble.com/Can-I-save-an-array-of-preferences-tp3689120p3689121.html
Hi Alan,
your first suggestion would simply create a single key named
"captureTool.ifCapture[i]", with 'i' being the letter 'i' and the
square brackets also being characters in the key.
As far as I can say, String concatenation is the only way to do it,
so your macro calls are perfect!
Michael
________________________________________________________________
On 4 Mar 2010, at 16:32, Alan Hewat wrote:
> 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> ______________________________________________