I will post what I can, but because of security etc I can not exactly post too much.
I have included a screenshot of the page we use.
An account number is entered in the top left hand box, we press tab and this then populates the rest of the page. I have left outstanding the box that will contain the value I need to grab.
Here is some of the source code for the web page, when viewed as source after it has finished loading. I have replaced most variables with XXX, and the part that affects what I need I have replaced with QQQ and WWW (again for security issues).
I have not copied the whole text, as some of it is in blocks, ie do a load of functions for checks, populate the fields etc:
<! -- 21/12/2005,08:36:30 -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<LINK rel='stylesheet' type='text/css' href='Styles/style.css'>
<SCRIPT LANGUAGE="JAVASCRIPT" src="xxx.js"></SCRIPT>
<SCRIPT LANGUAGE="JAVASCRIPT">
var xxx= 0;
var xxx= "";
var xxx = "xxx";
var xxx= "xxx";
var xxx;
var xxx;
var xxx= 1;
var xxx= false;
top.CaptureClose.document.all.xxx.value='N';
var cPFT_MSP = 1;
var cPFT_FA = 4;
var cPFT_TOMP = 5;
var cPFT_COMBINED = 6;
var cPFT_PT = 7;
var cPFT_MAINT = 8;
var cPFT_DRAW = 9;
var cPFT_PAYARRANGE = 10;
var sErrMsgs;
var bButtonSelected
bButtonSelected = false;
if ("" == "True") {
xxx= true;
xxx= false;
}
if ("" == "True") {
xxx= false;
xxx= true;
}
function xxx(strFldName,strMand)
{
top.xxx(strFldName,strMand);
return true;
}
function xxx(sAction)
{
var xxx;
sChild= top.main.document.all.CHILD.value;
if (top.main.document.all.LOADED.value!="Y")
{
alert("Please wait until the page fully loads.");
return false
}
if (sChild=="Y" && sAction=="UNDERWRITE")
{
alert("This option is not valid in this screen.");
return false;
}
if (bButtonSelected)
{
alert("Please wait until previous action has been processed.");
return false
}
else
bButtonSelected = true;
//top.footer.FooterTable.style.visibility="hidden";
return true;
}
THERE ARE OTHER PIECES OF CODE IN THIS BIT, BUT THEY FOLLOW A SIMILAR PROCEDURE TO THE ABOVE EXAMPLE. i HAVE HAD TO REPLACE VARIABLES WITH XXX DUE TO THE NATURE OF THE BUSINESS (CAN'T RISK ANYTHING!)
</SCRIPT>
<script language=javascript>top.XXX("XXX", "1");top.bSiteMapEnabled = false;top.header.xxx.src = 'xxx.gif';</script><INPUT TYPE="HIDDEN" NAME="CHILD" ID="CHILD" VALUE="N">
AND THEN SOME A LOAD MORE INSTRUCTIONS SIMILAR TO THE ABOVE LINE
<script language='javascript'>
//JUN04
function printPage()
{
if (window.print)
{
window.print()
}
else //IE 4
{
WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="' XXX"></OBJECT>';
document.body.XXX('beforeEnd', WebBrowser);
execScript("on error resume next: WebBrowser1.ExecWB 6, 1", "VBScript");
WebBrowser1.outerHTML = "";
}
}
//END JUN04
SOME MORE FUNCTIONS ARE HERE^^^
</script>
<script language=javascript>top.header.XXX.src = 'IMAGES/XXX.gif';</script><input type=hidden id="XXX" name="XXX" value=""><input type=hidden id="XXX" name="XXX" value="XXX">
SOME MORE INSTRUCTIONS SIMILAR TO THE ABOVE<TABLE class='mainfirst' cellspacing='0' cellpadding='0'><TR><TD WIDTH = '21%'><LABEL CLASS='XXX'>XXX</LABEL></TD></TR>
SOME OTHER CODE TO POPULATE THE SCREE HERE<TD WIDTH = '14%'>QQQ</TD><TD WIDTH = '1%'>£</TD><TD><INPUT CLASS='mediumnumber' id="WWW" name="WWW" value="99999" readOnly></TD></TR>AND THEN SOME MORE CODE TO POPULATE THE PAGEAND THEN SOME MORE CODE TO FILL THE PAGE, CARRY OUT FUNCTIONS ETC</script></HTML
and the VB I am trying is:
This gets me the IE URL (when it is already populated with data):
Sub ListShellWindows()
'Get all currently open IE and Explorer windows (those are based on the same class).
'For IE windows, get location. For WE windows, get path.
Dim objShell As Shell
Dim objIE As InternetExplorer
Dim objExplorer As ShellFolderView
Dim obj As Object
Set objShell = New Shell
For Each obj In objShell.Windows
If TypeName(obj.Document) = "HTMLDocument" Then
Set objIE = obj
Range("a1").Value = objIE.LocationURL
Else
Set objExplorer = obj.Document
MsgBox objExplorer.FocusedItem.Path
End If
Next obj
End Sub
and this bit is the part I am trying to use to get the field:
'Find an IE window with matching location and get a reference
'to the document object from the loaded page. Assumes no frames.
Function GetHTMLDocument(sAddress As String) As Object
Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String
Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
'see if IE is already open
For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.Document.Location
On Error GoTo 0
If sURL <> "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.Document
Exit For
End If
End If
Next o
Set GetHTMLDocument = retVal
End Function
Sub Button4_Click()
Dim a As Object
Dim b As String
Set a = GetHTMLDocument("http://hww.mortgagesales.hx-online.hxgroup.com/NMSPFramework.asp?MODE=HxCompletions&PROCFLOW=1&sRole=11&sLogicalDate=2005-12-20&CLIENTSPEC=*4251*109*")
MsgBox a.Document.Forms(4).txtAdvanceXX.Value
'MsgBox a.getElementById("txtAdvanceXX").Value
'MsgBox a.Document '.body.innerText
End Sub
I think that's about all I can give you I'm afraid. I don't understand most of it, but this is the only way forward from how I perceive things, due to not being able to navigate manually to the web page.