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:

post-68799-0-37207800-1425325629_thumb.g

And the eventual error window gives me this:

post-68799-0-31715700-1425325627_thumb.g

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
Next
Link to comment
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:

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
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...