Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to fill web page fields from a Win32 Delphi application.

Posted on 2006-06-08
5
Medium Priority
?
184 Views
Last Modified: 2010-04-05
Hello.

I need to fill some web page fields with data that is already in a Windows 32 Delphi application.

The problem is that I don't know the name of the fields of the web page because it has
frames and the right mouse button (to see the source code) is disabled. If I use the browser's
menu: View/"Source code" I only get this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
            <TITLE>Logistics System 2.01</TITLE>
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="C#" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <SCRIPT language="javascript">history.forward();</SCRIPT>
            <SCRIPT language="javascript">self.resizeTo(1024,768);</SCRIPT>
      </HEAD>
      <FRAMESET border="0" frameSpacing="0" rows="71,*" frameBorder="NO" cols="*">
            <FRAME name="frmEncabezado" src="wfrEncabezado.aspx" frameBorder="no" noResize scrolling="no">
            <FRAMESET frameSpacing="0" frameBorder="no" cols="184,786">
                  <FRAME name="frmMenu" src="wfrMenu.aspx" frameBorder="yes" bordercolor="#005fb3" scrolling="yes">
                  <FRAME name="frmTrabajo" src="wfrBlank.aspx" frameBorder="no" scrolling="yes">
            </FRAMESET>
      </FRAMESET>
</HTML>
 

In the Windows 32 application I have all the data that the users have to type manually to the web form, and I want to copy the data automatically when they push a button "copy data". The web application is from another company and I
have no access to the code.


Thanks in advance.

0
Comment
Question by:arturosm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Accepted Solution

by:
atul_parmar earned 1000 total points
ID: 16868512
As I extensively use javascript I would suggest it. Because you dont know the field name where you want to set the value you wil have to find the correct field first and then set its value.

Here is the javascript that goes through all the elements and displays all of them in alert.

var
  s : TStringList;
begin
  s := TStringList.Create;
  s.Add('javascript:function myselect() {');
  s.Add('var ecnt=document.forms[0].elements.length;');
  s.Add('var i;');
  s.Add('var elist="";');
  s.Add('for (i=0; i<ecnt; i++) {');
  s.Add('el = document.forms[0].elements[i];');
  s.Add('elist=elist+el.name+"="+el.type+"\n";');
  s.Add('}'); //end for
  s.Add('alert(elist);'); //end for
  s.Add('}; myselect();');
  WebBrowser1.navigate(s.text);
  s.Free;
end;

I hope this will help you. and once you know the field name setting its value is pretty simple.

See the following on how to set values through javascript.
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21867605.html
0
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 1000 total points
ID: 16873633
You need to obtain the HTML source from the frame that has the elements you want to fill in.
Then you can call the functions in my post here to fill them.
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20848037.html

You'll have to modify the sAction and sMyFormTitle variables and the parameters in the array passed
to FormSubmit to match what is in the form on the frame.

This works on a running instance of IE.
0
 

Author Comment

by:arturosm
ID: 16898842
Thank you friends,

Sorry, I have been very busy and shifted from this subject to another more urgent. However, I still have to solve this one. I'm going to review with care your comments tomorrow.

Thank you very much for your help.


arturosm

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question