Opened 12 years ago
Closed 12 years ago
#2208 closed Feature Request (Rejected)
ControlGetText not working on calculator
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | Severity: | None | |
Keywords: | Cc: |
Description (last modified by Valik)
Win7 64 bits mode (and 32 bits mode)
Unable to get text of (static) control. Reproduced with below code on calculator.
I believe this is due to changed behaviour of WM_GETTEXT in Win Vista/7 (and as such probably not a bug) but for standardcontrols would be nice if there is a workaround to get for example the text labels of the calculator buttons.
Also AU3Info x64 and x86 hoovering over the buttons give no text value and spy++ neither.
;Calculator, make sure its started ;$calcHWND = WinGetHandle("[CLASS:SciCalc]") $calcHWND = WinGetHandle("[REGEXPCLASS:.*Calc.*]") if $calchwnd = "" Then run("calc.exe") sleep(2000) ; $calcHWND = WinGetHandle("[CLASS:SciCalc]") $calcHWND = WinGetHandle("[REGEXPCLASS:.*Calc.*]") EndIf winactivate($calcHWND) Local $hHandle = ControlGetHandle("", "", "[CLASS:Button; INSTANCE:8]") Local $aPos = ControlGetPos("", "", $hHandle) local $cText= controlgettext("","",$hHandle) Local $wText = wingettext($hHandle) Consolewrite("Window Stats:" & "Position: " & $aPos[0] & "," & $aPos[1] & @CRLF & "Size: " & $aPos[2] & "," & $aPos[3] & @CRLF) ConsoleWrite("text:" & $cText & @crlf) consolewrite("text2:" & $wText & @crlf)
Attachments (0)
Change History (5)
comment:1 Changed 12 years ago by TicketCleanup
- Version 3.3.8.1 deleted
comment:2 Changed 12 years ago by Valik
- Description modified (diff)
comment:3 follow-up: ↓ 4 Changed 12 years ago by trancexx
The ting is that these controls doesn't respond to messages we send.
Alternative could be to use UI Automation API (that's not available on all systems). That works even for those controls. However, the results are sometimes different than expected. For example, the text from calc number buttons is successfully get (text from button 8 is "8") and matches the one it's printed on them, but for CE button retrieved text is "Clear Entry".
comment:4 in reply to: ↑ 3 Changed 12 years ago by junkew@…
MSAA works on all platforms although going forward UI automation is a better choice.
Microsoft's inspect.exe 64 bits gives same result on CE button so somehow the text CE is not retrievable.
Anyway it would be an improvement to get more details by integrating ui automation on platforms that have uiautomationcore.dll installed (from Win 7 version upwards that should be the case) that at least for some controls we have more information available to act on.
comment:5 Changed 12 years ago by trancexx
- Resolution set to Rejected
- Status changed from new to closed
It would only confuse users more.
My opinion at this point is that ControlGetText should not return this text as it can be anything and not necessarily what's displayed on control.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Automatic ticket cleanup.