Login  Register

Re: How to save macro variables' values in a text file ?

Posted by Thomas Leonardo on Feb 18, 2013; 9:30pm
URL: http://imagej.273.s1.nabble.com/Re-How-to-save-macro-variables-values-in-a-text-file-tp5001804.html

Dear ImageJ users,

I apologize if this question is already documented, I could not find
anything on the internet.

I am writing a macro which starts with a dialog box, allowing to set string
variables. I would like to record the values entered by the user into a
file (typically a text file), so that the next time the macro is used the
default values will be the one entered before (rather than the "factory
settings").

I can easily read variables values from a text file by using a function
like this one...

function getValues() {
  dataString=File.openAsString(initializationFilePath);
  rows=split(dataString, "\n");
  variable_1=rows[0];
  variable_2=rows[1];
}

...but I am unable to "update" the values in the text file, or even to
overwrite it.

Could you please give me some clues on how to do that?

Sincerely,
Thomas

PS: sorry for double-posting, the first message was inadvertently sent!

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html