问题
I have a script that is throwing and error when I issue a ControlGet. OtPtVar := AfxWnd422 strMPP := Material Planning Profile ControlFocus,%OtPtVar%,,%strMPP% Control,Show,,%OtPtVar%,,%strMPP% These all work but when it gets to the next line it throws an error: ControlGet,sysList,List,,%OtptVar%,,%strMPP% The control is a grid with five fields row number,Part,Description,Time,Lateness.
`ControlFocus,%OtPtVar%,,%strMPP%`
`Control,Show,,%OtPtVar%,,%strMPP%`
`ControlGet,sysList,List,,%OtPtVar%,,%strMPP%`
The error occurs on the last line. Thank you.
回答1:
After searching the AutoHotKey site I found to the following: Those Afx window classes were custom classes distributed with early versions of MFC, before the "Common Controls" concept was introduced.
Many people have tried to "read" text from them but you CAN'T, not with messages anyway!
They're almost certainly owner-drawn - the text is not delivered by messages, it's "hand-drawn" into the window's DC
...
Messages are a dead-end I think - those who have pursued this problem must have already clocked up several hundreds of hours of monitoring message traffic between them! So its not possible to get a hold of the control.
回答2:
ControlGet's List subcommand can only handle standard listview controls, which usually have the class 'SysListView32'.
Did you try AccViewer just in case.
This link mentions textcapturex by Deskperience Software in case that helps.
"AfxWnd42s" Please Help - AutoIt General Help and Support - AutoIt Forums
https://www.autoitscript.com/forum/topic/49057-afxwnd42s-please-help/
There are theoretically process hacker methods, but I'm not an expert on those, and wouldn't recommend such methods.
And yes, unfortunately when I really needed to, I used OCR once. Potentially you can do OCR, recreate the text in the same font, and check for an exact image match as a double-check. Also, if possible, set the font to one where characters such as capital i and small L are unambiguous.
来源:https://stackoverflow.com/questions/41230725/autohotkey-controlget