Jump to content

Cannot read sub-control

Recommended Posts

A process I'm trying to automate creates a popup window that stays there for the whole duration, and if it runs into a problem, it creates a type of sub-window (sub-control?), beneath itself, that can be somewhat identified via AutoIt's Window Info, but I have been unable to read it from a script.

The permanent window gives me this info:


And the eventual error window gives me this:


I am looking for the error message in [CLASS: Static; INSTANCE: 2], but whether I address it via this class specifier, or via the ID, I never get anything back.

If I use the code below, to search through all windows with the "VBS3" title (which those two seem to have), I only get the little one at the top back (twice):

$windows = WinList("VBS3")
For $i=1 To $windows[0][0]
    $size = WinGetPos($windows[$i][0])
    ConsoleWrite($windows[$i][0] & ": " & $size[2] & "/" & $size[3] & @CRLF)
   ; returns "VBS3: 245/81" twice

Share this post

Link to post
Share on other sites

how about this: if you get two results, query the style of each. the styles differ, so you can derive the handle according to the style. then use the handle to access the desired one.

note: by the looks of it, it may well be that this error message cannot be automated (retrieve data or click OK). if so, at least you can be informed that an error appeared, and someone needs to address it manually. hope it doesn't happen that much  :rolleyes:

Share this post

Link to post
Share on other sites

Actually, it seems I just found a method.

The problem was that both windows have the same title, and if I query them by that I always get the first one back. But if instead I use the handles that are returned by WinList, I do get the proper sizes and control texts!

Unfortunately, these errors happen all the time, and if they do, I have to re-download the affected file — all of which I'm trying to do while I'm still in bed... ;)

Edited by Frescard

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

  • Create New...