Sign in to follow this  
Followers 0
Newbie2

How to "tag" existing window

6 posts in this topic

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? :D

10x

Share this post


Link to post
Share on other sites



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" )

Share this post


Link to post
Share on other sites

Though about it. Can't change the name of the windows.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

10x, dude. :D

Share this post


Link to post
Share on other sites

Instead of changing the title you can just get the handle of the window. Each handle is unique.

WinGetHandle(....)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0