Re: Dialog.addChoice with Variables / Variables in an Array?
Posted by
Gabriel Landini on
Jul 30, 2014; 2:29pm
URL: http://imagej.273.s1.nabble.com/Dialog-addChoice-with-Variables-Variables-in-an-Array-tp5008965p5008972.html
On Wednesday 30 Jul 2014 06:08:38 you wrote:
> 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?
Green is a variable, "Green" is a string, so change the above to:
choices = newArray(Green, Red);
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html