--- In [email protected], sgp <[EMAIL PROTECTED]> wrote:
>
> Sheri wrote:
>
> > local mainwin=window("firstwindow","c=mainclass")
> > local subs=win.childhandlelist(mainwin,"c=subclass")
> >
> > subs has some visible and some not visible windows.
>
> I think you could filter out invisible windows by adding one line
> (UNTESTED):
>
> local mainwin=window("firstwindow","c=mainclass")
> local subs=win.childhandlelist(mainwin,"c=subclass")
> local vissubs=win.handlelist(replacechars(subs," ,"))
>
--- In [email protected], sgp <[EMAIL PROTECTED]> wrote:
>
> Sheri wrote:
>
> > local mainwin=window("firstwindow","c=mainclass")
> > local subs=win.childhandlelist(mainwin,"c=subclass")
> >
> > subs has some visible and some not visible windows.
>
> I think you could filter out invisible windows by adding one line
> (UNTESTED):
>
> local mainwin=window("firstwindow","c=mainclass")
> local subs=win.childhandlelist(mainwin,"c=subclass")
> local vissubs=win.handlelist(replacechars(subs," ,"))
>
Hi sgp, thanks for the suggestion, it doesn't work (produces an empty
string). Here's what I've done which seems to be working, my first use
of vectors. I guess I still need to destroy the vectors even though
they're assigned to local variables. Wonder what happens as far as
memory if I don't destroy the vectors but just keep re-creating them?
The script works, but not sure if there's a memory loss.
Regards,
Sheri
local mainwin=window("firstwindow","c=mainclass")
local subs=win.childhandlelist(mainwin,"c=subclass")
local wintops vishandles
static HighHan MidHan
for (j=1; ;j=j+1)
myevalhandle = word(subs,j)
if (myevalhandle == "") do
break
elseif (win.visible(myevalhandle)==1) do
wintops=wintops++win.top(myevalhandle)++"\n"
vishandles=vishandles++win.handle(myevalhandle)++"\n"
endif
endfor
vTops=vec.createFromLines(wintops)
vhandles=vec.createFromLines(vishandles)
vTops.doublesort(vhandles)
HighHan=vhandles[0]
if (vhandles.length > 1) do
MidHan=vhandles[1]
endif
vTops.destroy
vhandles.destroy
quit