Login  Register

Re: Text window name?

Posted by ctrueden on May 17, 2007; 2:47pm
URL: http://imagej.273.s1.nabble.com/Text-window-name-tp3699442p3699443.html

Hi Gabriel,

The name of the window is "Sine/Cosine Table" without the brackets.
But when passing a plugin argument string, you must place brackets
around argument values with spaces -- otherwise it would be
interpreted (in this case) as "name=Sine/Cosine" with "Table" as an
enabled boolean parameter. For print, according to the macro language
documentation, multiple arguments with commas are just concatenated
with a space between each, meaning you would have the same problem of
ambiguous window titling if brackets were not used. None of this is an
issue for window titles with no spaces.

-Curtis

On 5/17/07, Gabriel Landini <[hidden email]> wrote:

> Hi,
> I am curious about this:
> Below is the SineCosineTable2.txt macro from the IJ site, why does one have to
> surround the title in "[ ]" to create the table and print to it, but use the
> same string without "[ ]" to test whether it is open?
>
> -------8<--------
>   requires("1.38m");
>   title1 = "Sine/Cosine Table";
>   title2 = "["+title1+"]";
>   f = title2;
>   if (isOpen(title1))
>      print(f, "\\Clear");
>   else
>      run("New... ", "name="+title2+" type=Table width=250 height=600");
>   print(f, "\\Headings:n\tSine\tCosine");
>   for (n=0; n<=2*PI; n += 0.1)
>      print(f, n + "\t" + sin(n) + "\t" + cos(n));
> -------8<--------
>
> Thanks,
>
> Gabriel
>