IJ.Prefs is the good old IJ1 way to go and it's quite reliable. It also teaches people how to store variables when writing their plugins.
The only thing is that your keys should have rather unique identifiers internally, so that your
variableA should be internally named something like
Which looks a bit messy for non-coders at first.
Then you will have to offer some wrapper functions as there is no setPreferences or get Preferences in the ImageJ Macro Language, so you need to use the
// Set a variable into ImageJ Prefs
call("ij.Prefs.set", "test.variable.1.demo.var", 10);
// Recover a variable from ImageJ Prefs, return "unset" if it was not there
val = call("ij.Prefs.get", "test.variable.1.demo.var","unset");
However, as for the text window, these will not be temporary, they will remain in the "IJ_Props.txt" and "IJ_Prefs.txt" files even if the plugins or macros crash.
Finally, the text window is nice from a teaching point of view as people can actually see the variables being affected and changed as they are being used, which is more interactive than the hidden IJ.Prefs elements.