Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get text (or automate) from an external control in a Java application (AWT)?

There is an application which is built in the SunAWTFrame class and, as you can guess, this is a strange world for the Windows API.

So I wonder, what should I do/use to get text from controls in a GUI built with this or automate them?

Is there some sort of API or library that can accomplish this and is suitable for work inside pure C++ or similiar language (not only Java)?

like image 309
Marko29 Avatar asked Nov 23 '25 14:11

Marko29


1 Answers

Your problem is likely due to the Java GUI being a Swing GUI program (note that the MS Windows class for these GUI's -- at least I know for JFrames -- is "SunAWTFrame"), and since Swing uses light-weight components, not MS Windows native components, you won't easily be able to extract window information from them. I don't know of any easy way around this without the Java source code.

Edit 1
After a little Googling some I have found new information:

  • Have you looked into using perhaps Java Monkey or Java Ferret?
  • Or perhaps best of all, Java Access Bridge which "is a technology that exposes the Java Accessibility API in a Microsoft Windows DLL, enabling Java applications and applets that implement the Java Accessibility API to be visible to assistive technologies on Microsoft Windows systems"
like image 196
Hovercraft Full Of Eels Avatar answered Nov 25 '25 02:11

Hovercraft Full Of Eels



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!