Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi Berlin 10.1 Update 1 / Screen Scraping

Status
Not open for further replies.

ResonantEcho

Programmer
Aug 17, 2010
24
US
Has anyone done any development in regard to screen scraping?

For example, let's say a form on the screen (not Delphi, but a Java applet) has several checkboxes. I would need to verify which are checked or not and update user data accordingly.

Thank you for your response in advance.


// ResonantEcho
 
How far along are you? My first suggestion would be this: Are you able to locate the form in question within the system itself? That's the first step.

 
Hi Glenn,

Yes. The application does identify forms by caption and enters information on said forms (emulating keyboard input). I've created classes for each form that I'm currently working with. Each class contains properties for that form (what data can be entered on that form). Also, methods to launch the form via hot keys (CTRL-S, CTRL-E, etc.). Likewise, methods to enter data on the form.

Since some of the properties and methods are similar, I have created a TDialog class which I inherit. It has properties such as IsActive, Caption, Description, etc.






// ResonantEcho
 
That really wasn't what I asked. More or less, controls are sub-windows of forms. So the task becomes finding the window handle of the form in the system you're interested in, then looking at the sub-windows to locate check boxes, and then sending messages to query their state.

It sounds like you should be able to handle this well, given what you already claim is being done.

 
Hi Glenn,

You asked how far along was I and if I was able to locate the form in question. I did answer both of those questions....I thought. :D With additional detail.

While I am able to load a form via a HOTKEY, verify it indeed exists (via caption), grab its window handle, make sure it has focus and is in the foreground, I am not identifying each individual control on the form. Up until now I didn't have a need to do that.

Because I know what is on the forms I'm currently working with, I simply enter data in the first control, tab to the next control, enter data in it, etc. Very simple. However, now I'm wanting to go a step further and analyze check boxes on a form to verify if they are checked/unchecked. Or grab text that is in a control to determine what step needs to be taken next. That's where I need help.

Thanks for responding.


// ResonantEcho
 
Never mind. I figured it out. You got me to thinking, Glenn. ;)

Since I already have the handle for the window, I then can use "EnumChildWindows" to get the handle to the checkbox. Then do:

Code:
if SendMessage(hWndForCheckBoxControl, BM_GETCHECK, 0, 0) = BST_CHECKED then
begin
  ShowMessage('Checkbox is checked.');
  
  // do checked process here
end
else
begin
  ShowMessage('Checkbox is not checked.');

  // do not checked process here
end;

There may be a better way, but I'll look into that tomorrow.


// ResonantEcho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top