Jump to content

AutoIt v3 Windows Info


Recommended Posts


I use AutoIt v3 Windows Info to get info:

Title       Débloquer le
Class     #32770
Position   518, 285
Size        243, 391
Style      0x94000846
ExStyle 0x00010008
Handle   0x001204F2

Then i use WinExists:

If WinExists("[CLASS:#32770]") Then
    MsgBox(0, "WinExists", "Window is found")

I can't use the title because this app is localized (title changes regarding the OS language) ... so is the CLASS property of a window always the same ???

Is there a tip to be sure it's THE window i'm waiting for and not another one with the same class ???

Help is needed here thank you :D

Edited by Jango
Link to comment
Share on other sites

Many of my windows - different applications even, come up the same class - #32770. Therefore the CLASS property of a window is not reliable.

What you could do is to use that class number, but cross-check for the presence of a control that is known to exist in the target window, which control has certain text that is also known:

Opt("WinDetectHiddenText", 1)
Opt("WinTitleMatchMode", 4)
$windowFound = False

$controlID = "ClassnameNN:Edit3"; insert the known control of the target window here - use the tool
$knownText = "zippity_dee"; insert known text of the target window's control here - use the tool

$WinArr = WinList("[CLASS:#32770]")

For $i = 1 To $WinArr[0][0]
    If ControlGetText($WinArr[$i][1], "", $controlID) = $knownText Then
        $windowFound = True

If $windowFound Then MsgBox(0, "WinExists", "The target window does indeed exist.")

Use the Window Info Tool again - but this time look for a Control that would exist on no other window and have no other text than it does. Use the "Control" tab item, there in the Window Info tool.

Edit: Code updated.

Those two parameters on lines 5 and 6 will be critical to making this work.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

  • 1 year later...

I tried it but the return value of ControlGetText function was always a blank string.

Could anybody tell me what's the reason?

Thanks in advance.

Oh, I got it!

It's CLASSNN but not ClassnameNN for the controlID parameter.

As to the example on #2 floor, change to $controlID = "[CLASSNN:Edit3]". That's ok.

Edited by AUTTRY
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

  • Recently Browsing   0 members

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