Newbie2 Posted June 21, 2004 Share Posted June 21, 2004 Guys, Let's asume I have x number of notepad windows with the following titles: "abc - session - blablabla" "def - session - blabla" "ghi - session - bla" I want to know how many windows exists assuming that the number of windows (x) can change? How can I do it? This is what I have written so far. Opt("WinTitleMatchMode", 2) $OpenedSessions=0 For $i=1 to 100 If WinExists ("session - ") Then ;found a window $OpenedSessions=$OpenedSessions+1 ;;;;;;;;?????;;;;;; EndIf Next There is no problem to check if these window exists but how to "tag" the one I have found in order not to count them again in the IF? 10x Link to comment Share on other sites More sharing options...
Program Posted June 21, 2004 Share Posted June 21, 2004 you can change the name of each window, if you know the name, so you put the name into a variable first using something like $name = wingetname("name") then change the name of the window WinSetTitle ( "title", "text", "newtitle" ) Link to comment Share on other sites More sharing options...
Newbie2 Posted June 21, 2004 Author Share Posted June 21, 2004 Though about it. Can't change the name of the windows. Link to comment Share on other sites More sharing options...
pekster Posted June 21, 2004 Share Posted June 21, 2004 Though about it. Can't change the name of the windows.Why not? The idea is to change them back when you are done. The name change would occur for less than 1 second, and then you can put them back. Basic idea is like this: Opt("WinTextMatchMode", 2);any valid substring match $count = 0 While WinExists("search title") $count + $count + 1 ReDim $TitleArray[$count];increase array for another stored title ;now change the title so we don't count it a 2nd time: WinSetTitle("search title", "", "Temporary Title " & UBound($TitleArray) - 1) WEnd For $i = 0 To UBound($TitleArray) - 1 WinSetTitle("Temporary Title " & $i, "", $TitleArray[$i];set title back Next [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
Newbie2 Posted June 22, 2004 Author Share Posted June 22, 2004 10x, dude. Link to comment Share on other sites More sharing options...
sugi Posted June 22, 2004 Share Posted June 22, 2004 Instead of changing the title you can just get the handle of the window. Each handle is unique. WinGetHandle(....) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now