Login  Register

Re: User input for a global variable in a macro?

Posted by Michael Doube on Dec 03, 2008; 9:53am
URL: http://imagej.273.s1.nabble.com/User-input-for-a-global-variable-in-a-macro-tp3694344p3694345.html

Bill,

If I understand you correctly, then yes you can set global variables for
a set of macros. You define the variables at the beginning of the macro
outside any of the installable submacros.  An example:

var myNewVariable = "Hi Bill";

macro "Read [1]"{
        Dialog.create("Enter Text");
        Dialog.addMessage("Enter some text");
        Dialog.addString("Text:", myNewVariable, 12);
        Dialog.show();
        myNewVariable = Dialog.getString();
}

macro "Write [2]"{
        print(myNewVariable);
}

Cheers

Mike