Posted by
Michael Schmid on
Jan 18, 2017; 8:07pm
URL: http://imagej.273.s1.nabble.com/getArgument-equivalent-for-installed-macros-tp5017917p5017921.html
> On Wednesday, 18 January 2017 10:19:45 GMT Bill Christens-Barry wrote:
>> In ImageJ I would like to pass a value from a macro in a text window to a
>> macro that has been installed.
>
>> The runMacro(name, arg) command will pass an argument to a macro that will
>> be run from a file, and this argument can be handled in the called macro
>> using the getArgument() command. But this entails opening the file
>> containing a called macro, rather than running an already installed macro.
On 18/01/2017 16:43, Gabriel Landini wrote:
> Does it require to have the other macro open?
> I had the idea (maybe wrong) that if the macro is just in the plugins folder
> and is visible to IJ (i.e. it has a "_" in the name) you can call it from
> another macro and the 2nd macro gets the argument the way you suggested.
Hi Bill,
if you find nothing else, there is one more option: passing variables
via the Preferences:
Write:
call("ij.Prefs.set", "myMacros.myText", myText);
Read (with default "nothing yet", if the Prefs item has not been set):
var myText = call("ij.Prefs.get", "myMacros.myText", "nothing yet");
The key, here "myMacros.myText", must be the same for read and write and
contain a period.
The key/value pair will be written to the user's IJ_Prefs.txt file. So
ImageJ will remember the value even if you close ImageJ and open it again.
Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html