Getting text from Delphi TPanel object

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Getting text from Delphi TPanel object

Post by Jerry Thomas » Fri Nov 12, 2010 5:00 pm

Our app is Delphi based and uses TPanel class displays for a lot of the numeric data.

I have tried the usual ways of getting text: GetControlText, GetTextAtPoint, GetTextInRect, GetWindowText, GetWindowTextEx.
These work where we have 'regular' text but not on the TPanels.

Here is a snippet from the System Windows tool
330770 - TGroupBox "Nozzle Position"
- 724926 - TPanel " -6.375"
- 1380106 - TPanel " 1.275"

I can get the TGroupBox label but not the TPanels.
GetControlText>OMAX*,TPanel,1,strText

strText is blank

I wrote a screen capture and compare routine to read one character at a time. The problem is, depending on the application mode and the OS, I have several possible 'styles' (yellow, green, red, and WinXP displays differently than Win7!). I am trying to not have 6 different sets of characters to compare against.

I have tried a couple of different OCR tools, with no luck.

Any suggestions?
Thanks,
Jerry

[email protected]

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Nov 12, 2010 7:56 pm

GetWindowTextEx, GetTextInRect and GetTextAtPoint should all work with Delphi TPanel objects.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Sat Nov 13, 2010 12:07 am

None of those work.
I have used the Sample Text Capture script and tried my own.
I can get other text but not from the TPanels.
Thanks,
Jerry

[email protected]

Athol
Newbie
Posts: 2
Joined: Sat Dec 05, 2009 12:27 pm

Post by Athol » Wed Dec 29, 2010 6:56 pm

Has anyone eventually managed to find a way to scrape data from a TPanel? Running into the same problem over here.

Thanks
Athol

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Post by Jerry Thomas » Tue Jan 04, 2011 3:22 pm

My problem turned out to be using the wrong Window.
Instead of the parent window title, I needed to use the section title.

MS's System Windows tool will show what you should use.
Thanks,
Jerry

[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts