Label with no ClassNN. How to find it or read text from Label another way?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
FalseShepard
Posts: 2
Joined: 28 Apr 2024, 15:36

Label with no ClassNN. How to find it or read text from Label another way?

Post by FalseShepard » 28 Apr 2024, 15:49

I'm writing a script to automate my work with a specific circuit emulator.

Everything is fine, except one window. When measuring chart values, I can't read a numeric value with AHK because the numeric value has no ClassNN.
It is important to clarify that this text cannot be selected by the mouse, it is something like a "label", not a "textbox"

I have tried Window Spy and a script to determine the object properties under the mouse pointer - the ClassNN remains empty. (See pic.)
I tried using Easy OCR but it makes errors, especially with numbers 6 and 9. I need to copy this text accurately, so I want to get direct access to this text field.

I'd appreciate any solutions provided.


FalseShepard
Posts: 2
Joined: 28 Apr 2024, 15:36

Re: Label with no ClassNN. How to find it or read text from Label another way?

Post by FalseShepard » 29 Apr 2024, 08:45

boiler wrote:
28 Apr 2024, 20:26
You may be able to use UIA.
Good lib, but doesn't help.

For example, I can get this label (it cant be selected by mouse) by its "Name" property
But as for "Линейка" window from what I need to extract value - there is no way to do it, even with UIA - it doesn't have a property that contains its value.
Maybe I do something wrong?

User avatar
boiler
Posts: 17142
Joined: 21 Dec 2014, 02:44

Re: Label with no ClassNN. How to find it or read text from Label another way?

Post by boiler » 29 Apr 2024, 09:48

FalseShepard wrote: Good lib, but doesn't help.
It's possible that it's just not available there either.

FalseShepard wrote: Maybe I do something wrong?
I don't have much experience with that library to know.

Descolada
Posts: 1163
Joined: 23 Dec 2021, 02:30

Re: Label with no ClassNN. How to find it or read text from Label another way?

Post by Descolada » 29 Apr 2024, 12:35

@FalseShepard in that case the text is most likely just not accessible. You could try reading the values directly from the programs memory, which would probably be rather difficult.

Alternatively try to optimize OCR performance. For example, with the OCR.ahk library you should set the zoom factor to 2 and make sure the language is correct (probably should be "ru"). Also, the built-in Windows OCR which OCR.ahk uses isn't the most accurate, other OCR engines such as Tesseract might give better results.

Another option would be to implement OCR yourself by using the FindText library: you would need to capture images for all individual numbers from 0-9, do the FindText call, and then use FindText's OCR function.

Post Reply

Return to “Ask for Help (v2)”