Login  Register

Re: Text window management in a macro

Posted by Wayne Rasband on Mar 16, 2007; 8:32pm
URL: http://imagej.273.s1.nabble.com/Text-window-management-in-a-macro-tp3700049p3700050.html

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
>