Just find out that the unwanted items can be filtered by win.hascaption(cl). Their return of hascaption(cl) are NOT 1.
The only issue is the icon now. Seems there is no way to retrieve the icon of a window by its handle? Please help. On Thu, Mar 26, 2009 at 1:41 PM, xiaop...@gmail <[email protected]> wrote: > Thanks for the reply from Brucexs! > > I composed the with the follow script according to ur suggestion. It works > with some small problems. > ------------------- > handlev=vec.createFromWords(win.handleList("*",2)) > for (j=0;j<handlev.length;j=j+1) > if (!win.visible(handlev[j])&&!win.trayminned(handlev[j])) do > handlev.delete(j) > j=j-1 > endif > endfor > menuv=vec.create(handlev.length) > for (j=0;j<handlev.length;j=j+1) > ;index from 0-9 > if (j<=9) do > mycap=j ++" "++ win.caption(handlev[j]) > elseif (j<=35) > ;index from a-z > str =55+j > mycap=case("fromnum", str)++" "++ win.caption(handlev[j]) > else > mycap="@"++" "++ win.caption(handlev[j]) > endif > menuv[j] = mycap > endfor > selectedwin = menuv.showmenu("",1,"") > if (selectedwin != -1) do > win.show(handlev[selectedwin]) > endif > menuv.destroy > handlev.destroy > ------------------------------------ > IN the attached screen shot, there is three unexpected items (No.0, an > invisible window no title, and N0. 2 the bar of powerpro, and the last one > "program manager" which is also invisible). For the two invisible item, the > win.visible() returns 1 for both of them. Where is the problem? > If fact, filtering with .visible() and .trayminned() gimme the same list > if I just use win.handlelist("*"). > I can add specific codes to remove the three unwanted items, but i think > there should be a more elegent way. > > The most important question is: is it possible to add program icons to the > menu? Without icons, the list is not a better choice than *windows show > menu. Forthermore, is it possible to format the menu, change the Font and > color of the text (not the background). > > Sean > 3/26/2009 > > > > > On Thu, Mar 26, 2009 at 8:39 AM, brucexs <[email protected]> wrote: > >> >> > Since active window list is so close to perfection, I cant help >> wondering is there any way to customize the items of this menu, adding an >> unique index to each one. >> >> You could write a script which gets handles of all top-level windows >> (win.handlelist("*", 2), eliminates invisible ones which are not tray minned >> via win.visible and win.trayminned, gets captions prefixed by &x for >> remaining window handles in parallel vector, shows captions+&x using >> vec.showmenu, then switches to selected window handle using flavour of >> win.show(h, x) that works best for you. >> >> >> > > [Non-text portions of this message have been removed]
