Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Get text from an MDI / ThunderRT6MDI / DataGridWndClass

  • Please log in to reply
1 reply to this topic
  • Members
  • 33 posts
  • Last active: May 13 2017 05:26 PM
  • Joined: 27 Aug 2012

Hey guys, I've spent a solid chunk of the day searching/googling/testing/looking for a way to get text from a MDI / ThunderRT6MDI / DataGridWndClass application, but haven't had any luck. To be clear, I'm able to get many of the fields, but this one in particular I haven't been able to crack. It looks like a dropdown list, but I haven't had these issues with other DDLs in the program, so I don't think it's actually a DDL. It's like a text box that when you hit the arrow drops down a list of selections. When you choose one, it changes the value in the text box. You can also hit the first letter of the value and it will change the text box. I know that's pretty vague, but I don't know how else to describe it.

Any thoughts on what I could try?

Below, please see some test script I've run to try to get a value for this field. I've also tried using Winspector to intercept messages being sent, but there doesn't appear to be any recognizable text coming through from what I can tell.

    MouseGetPos,,,,hwndMouse, 2
    ControlGetText, txtMouse,, ahk_id %hwndMouse%
    WinGet, hwndFocusWindow, ID,, STRUCTURE # ;This gets the HWND of the parent window, which is a control inside the main window.
    ControlGetFocus, nameFocus, ahk_id %hwndFocusWindow% ;This gets the name (NOT HWND) of the focused control within the STRUCTURE # control.
    ControlGet, hwndFocus, hwnd,, %nameFocus%, ahk_id %hwndFocusWindow% ;This gets the HWND of the focused control using the control name and the parent control HWND
    ControlGetText, txtFocus,, ahk_id %hwndFocus% ;This is giving me a value of '6' regardless of what the text displays from the (what appears to be a) dropdown menu.
    ControlGet, testFocus, List,, ahk_id %hwndFocus%
    ControlGet, testFocus2, List, Count, ahk_id %hwndFocus%
    ControlGet, testFocus3, Selected,, ahk_id %hwndFocus%
    ControlGet, testFocus4, CurrentLine,, ahk_id %hwndFocus%
    ControlGet, testFocus5, Style,, ahk_id %hwndFocus%
    MsgBox, % "hwndMouse:" hwndMouse ".`n"  "txtMouse:" txtMouse ".`n" "txtFocus:" txtFocus ".`n" "hwndFocusWindow:" hwndFocusWindow ".`n" "nameFocus:" nameFocus ".`n" "hwndFocus:" hwndFocus ".`n" "testFocus:" testFocus ".`n"  "testFocus2:" testFocus2 ".`n"  "testFocus3:" testFocus3 ".`n"  "testFocus4:" testFocus4 ".`n"  "testFocus5:" testFocus5 ".`n"
    ;~ SendMessage, 0x188, 0, 0, ListBox1, WinTitle  ; 0x188 is LB_GETCURSEL (for a ListBox).
    SendMessage, 0x147, 0, 0, %nameFocus%, ahk_id %hwndFocusWindow%  ; 0x147 is CB_GETCURSEL (for a DropDownList or ComboBox).
    ChoicePos = %ErrorLevel%  ; It will be -1 if there is no item selected.
    MsgBox % ChoicePos ;Always yields 1

Thanks for looking.

  • Members
  • 33 posts
  • Last active: May 13 2017 05:26 PM
  • Joined: 27 Aug 2012

Anyone have any thoughts on this?


Are there any reliable methods of using OCR on text in specified locations?