Login  Register

Dialog.addChoice with Variables / Variables in an Array?

Posted by rayh on Jul 30, 2014; 1:08pm
URL: http://imagej.273.s1.nabble.com/Dialog-addChoice-with-Variables-Variables-in-an-Array-tp5008965.html

Hi!
I'm setting up a macro in which the user is supposed to choose the applied file via a popup menu, as in this exemplary snippet:

Green = "File1";
Red = "File2";
choices = newArray("Green", "Red");
Dialog.create("Test");
Dialog.addChoice("Slide 1", choices);
Dialog.show();
Result = Dialog.getChoice();
print(Result);

The filepaths are set as variables, and I'd like the user's choice in the dialog to translate into the string of the respective variable, i.e. choosing "Green" or "Red" in the dialog is supposed to print "File1" or "File2", respectively -but instead I only recieve "Green" or "Red". How can I make the macro utilize the strings from the appropriate variables?

-Ray