Login  Register

Re: Text window name?

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

Hi Gabriel,

Ah, I should have read the macro documentation more thoroughly. From
the web site:

"Starting with ImageJ 1.38m, the second argument to print(arg1, arg2)
is appended to a text window or table if the first argument is a
window title in brackets."

So the situation with print is a special case. If the first argument
is something in brackets, it is interpreted as a file. Otherwise, it
is merely concatenated.

Note that your working macro still works if you change the f2 to f1 in
the "run" command (because "Test" contains no spaces).

-Curtis

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

> On Thursday 17 May 2007 14:47:28 Curtis Rueden wrote:
> > None of this is an
> > issue for window titles with no spaces.
>
> I agree in theory, but not in practice :-)
> Not sure if this is a bug, then:
>
> This does not work in linux (it prints to the Log window instead):
>
> //======================
> f1 = "Test";
> f2 = "["+f1+"]";
>
> // --- to a table window
> if(!isOpen(f1)){
>   run("New... ", "name="+f1+" type=Table width=300 height=400");
>   print(f1, "\\Headings:Filed1\tField2\tField3");
> }
> x=1;
> y=2;
> z=3;
> print(f1,x+"\t"+y+"\t"+z);
> //======================
>
> But this does work (i.e. it prints to the Test table):
> The difference is the [ ] in the table creation and the print statements. They
> are both strings without spaces.
>
> //======================
> f1 = "Test";
> f2 = "["+f1+"]";
>
> // --- to a table window
> if(!isOpen(f1)){
>   run("New... ", "name="+f2+" type=Table width=300 height=400");
>   print(f2, "\\Headings:Filed1\tField2\tField3");
> }
>
> x=1;
> y=2;
> z=3;
>
> print(f2,x+"\t"+y+"\t"+z);
> //======================
>
> Cheers,
>
> Gabriel
>