Jump to content

winGetHandle on a window that changes classname


 Share

Recommended Posts

Hi guys,

I'm playing around with a little project to try to learn more about Autoit. So far i'm loving it. Here is my question: How can I get the handle of a window that likes to change both class name and title? The window seems to have the classname of "window" + any number from 1-5(maybe 1-10 ie "window3" or "window5"). The other problem I have is there will be two or more of these windows on the screen at any given time and I need to pick the one with the right info. Below is what I was working on and not getting anywhere:

Global $counter = 1

    while ($counter <= 10)
        Global $windowCheck = "window" & $counter
        Global $myWindow = winGetHandle("classname=$windowCheck", "text on the right window")
        if $myWindow <> "" then $counter = 10
        $counter = $counter + 1
    wEnd

At the last second another question came to mind. I have a control that comes up with no text or "(control text hidden)" If I run a check to see what text is on the control will i be able to tell if there is nothing there or if it's hidden?

Thanks,

d2a007

Link to comment
Share on other sites

Hi guys,

    I'm playing around with a little project to try to learn more about Autoit. So far i'm loving it. Here is my question: How can I get the handle of a window that likes to change both class name and title? The window seems to have the classname of "window" + any number from 1-5(maybe 1-10 ie "window3" or "window5"). The other problem I have is there will be two or more of these windows on the screen at any given time and I need to pick the one with the right info. Below is what I was working on and not getting anywhere:

Global $counter = 1

    while ($counter <= 10)
        Global $windowCheck = "window" & $counter
        Global $myWindow = winGetHandle("classname=$windowCheck", "text on the right window")
        if $myWindow <> "" then $counter = 10
        $counter = $counter + 1
    wEnd

At the last second another question came to mind. I have a control that comes up with no text or "(control text hidden)" If I run a check to see what text is on the control will i be able to tell if there is nothing there or if it's hidden?

Thanks,

d2a007

<{POST_SNAPBACK}>

it changes class AND title eh? use AutoIT Window info to get more info on the window, specifically window text, maybe some control constants (labels are good for picking one window from another)

also, instead of the checking the first 10 windows, you may want to do something like this:

$ListOWins = WinList()
for $x = 1 to $ListOWins[0][0]
 if StringInStr(WinGetText($ListOWins[$x][0]),"Static Text that is in window regardless of window title or class name") Then
     MsgBox(0,"Found It","Click OK for your window")
     WinActivate($ListOfWins[$x][0])
EndIf
Next
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...