Text window management in a macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Text window management in a macro

Simon Roussel
Hi,
Within a macro, I would like to retrieve all non image windows opened.
I cannot figure out how do do this.
For images I can use:

 titles = newArray(nImages);
         for (i=1; i<=nImages; i++) {
                selectImage(i);
                titles[i-1]=getTitle;
                print(titles[i-1]);
          }

I can also activate a text window if I know its name:
selectImage(id) or selectWindow("name")

but how can I list non-image windows opened (which I can find listed under
the Window menu, above the list of images).
 
If it is not possible, I would suggest new macro functions like:
nWindows (returns nImages+ number of other windows opened).
and selectWindow() with a possibility to pass "id" as an argument (requires
that non images also have an id), would be something very nice, and usefull ....

Thanks
simon
Reply | Threaded
Open this post in threaded view
|

Re: Text window management in a macro

Frederic V. Hessman
For those who write plugins, this capability is available starting  
with 1.38? (private up through 1.37?) using

        public synchronized static Frame[] getNonImageWindows()

Rick

On 12 Mar 2007, at 11:34 am, Simon Roussel wrote:

> Hi,
> Within a macro, I would like to retrieve all non image windows opened.
> I cannot figure out how do do this.
> For images I can use:
>
>  titles = newArray(nImages);
> for (i=1; i<=nImages; i++) {
> selectImage(i);
> titles[i-1]=getTitle;
> print(titles[i-1]);
>  }
>
> I can also activate a text window if I know its name:
> selectImage(id) or selectWindow("name")
>
> but how can I list non-image windows opened (which I can find  
> listed under
> the Window menu, above the list of images).
>
> If it is not possible, I would suggest new macro functions like:
> nWindows (returns nImages+ number of other windows opened).
> and selectWindow() with a possibility to pass "id" as an argument  
> (requires
> that non images also have an id), would be something very nice, and  
> usefull ....
>
> Thanks
> simon

------------------------------------------------------------------------
------------------------
Dr. Frederic V. Hessman     [hidden email]
Institut für Astrophysik          Tel.  +49-551-39-5052
Friedrich-Hund-Platz 1         Fax +49-551-39-5043
37077 Goettingen                 Room F04-133
http://www.Astro.physik.Uni-Goettingen.de/~hessman
------------------------------------------------------------------------
-------------------------
MONET: a MOnitoring NEtwork of Telescopes
http://monet.Uni-Goettingen.de
------------------------------------------------------------------------
-------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Text window management in a macro

Wayne Rasband
In reply to this post by Simon Roussel
You can get a list of the titles of non-image windows by using the
getList("window.titles") macro function, which was added in ImageJ
1.38m. Here is an example:

     list = getList("window.titles");
     for (i=0; i<list.length; i++)
         print(list[i]);

-wayne

On Mar 12, 2007, at 5:34 AM, Simon Roussel wrote:

> Hi,
> Within a macro, I would like to retrieve all non image windows opened.
> I cannot figure out how do do this.
> For images I can use:
>
>  titles = newArray(nImages);
> for (i=1; i<=nImages; i++) {
> selectImage(i);
> titles[i-1]=getTitle;
> print(titles[i-1]);
>  }
>
> I can also activate a text window if I know its name:
> selectImage(id) or selectWindow("name")
>
> but how can I list non-image windows opened (which I can find listed
> under
> the Window menu, above the list of images).
>
> If it is not possible, I would suggest new macro functions like:
> nWindows (returns nImages+ number of other windows opened).
> and selectWindow() with a possibility to pass "id" as an argument
> (requires
> that non images also have an id), would be something very nice, and
> usefull ....
>
> Thanks
> simon
>