?
Solved

Getting the next HTML page

Posted on 2001-08-09
11
Medium Priority
?
172 Views
Last Modified: 2010-04-06
Hi All,

I have D4 and win2k with NT. I am using a ActiveX WebBrowser_V1.
I am saving each html page and an associated text. This program always works on
any first selection correctly. But on the next selection on the same 'run'  it does not 'clear' itself so
that the next set of views are saved with the correct information. In fact it may be data
from  the previous one.


 procedure TForm1.Button1Click(Sender: TObject);
var
  Doc, V, Bod: OleVariant;
begin
  Memo1.Clear;
  Doc := '';
  Infolabel.Caption := '';
  Infolabel.Caption := 'Loading';
  webBrowser_V11.Navigate(Edit1.Text, V, V, V, V);
  while webBrowser_V11.Busy do
    Application.ProcessMessages;
  Doc := webBrowser_V11.Document;
  Bod := Doc.Body;

  Memo1.Text := Bod.InnerHTML;

  Memo1.Lines.SaveToFile(ExtractFilePath(Application.exeName) + Edit2.Text);

  Memo1.Text := Bod.InnerText;

  Memo1.Lines.SaveToFile(ExtractFilePath(Application.exeName) + Edit3.Text);

  Infolabel.Caption := 'Done';
end;


procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  if RadioGroup1.ItemIndex = 0 then begin Edit1.Text := 'http://users.swing.be/francois.piette/wsocketu.htm'; ;
    Edit2.Text := 'TWSocView.html'; Edit3.Text := 'TWSocView.txt'; end;

  if RadioGroup1.ItemIndex = 1 then begin Edit1.Text := 'http://www.marthastewart.com/television/program_guide/index.asp';
    Edit2.Text := 'MarthaAsp.html'; Edit3.Text := 'MarthaAsp.txt'; end;

  if RadioGroup1.ItemIndex = 2 then begin Edit1.Text := 'http://mathforum.com/mathgrepform.html';
    Edit2.Text := 'MathView.htm'; Edit3.Text := 'MathView.txt'; end;

  if RadioGroup1.ItemIndex = 3 then begin Edit1.Text := 'http://MarthaStewart.com';
    Edit2.Text := 'MarthaView.html'; Edit3.Text := 'MarthaComView.txt'; end;

  if RadioGroup1.ItemIndex = 4 then begin Edit1.Text := 'http://town.springhill.ns.ca/Anne_Murray_Centre.htm';
    Edit2.Text := 'AnnMury.html'; Edit3.Text := 'AnnMury.txt'; end;

  if RadioGroup1.ItemIndex = 5 then begin Edit1.Text := 'http://pacific.commerce.ubc.ca/xr/rates.html';
    Edit2.Text := 'PacMony.html'; Edit3.Text := 'PacMony.txt'; end;

end;

procedure TForm1.FormShow(Sender: TObject);
begin
  RadioGroup1.ItemIndex := 0;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Application.Terminate;
end;

end.

A correction is requested

Delphi3
0
Comment
Question by:delphi3
[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
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 6371709
Try clear DOC,V, Bod variants.
DOC:=UNASSIGNED;
V:=UNASSIGNED;
Bod:=UNASSIGNED;
after Memo1.Clear or
VarClear(DOC);
VarClear(V);
VarClear(Bod);
after infoLabel.Caption:='done';
ziolko.
0
 
LVL 6

Expert Comment

by:edey
ID: 6372781
And a little tip - IE has several overloaded navigate methods so you don't always need to call webBrowser_V11.Navigate(Edit1.Text, V, V, V, V); . If you don't need to pass any sepecial headers (unlikely) you can call webBrowser_V11.Navigate(Edit1.Text);

Also, webBrowser_V1 is, I believe an encapsulation of IE 4 & webBrowser is IE 5, so if you don't _need_ IE 4 I'd suggest using TWebBrowser instead.

GL
Mike
0
 
LVL 4

Author Comment

by:delphi3
ID: 6373057
ziolko,

Sorry but neither of these fixes work in my program, before or afterward.
I even tried both, but still the same problem.

I will  try  Mike's  suggestion next.

Delphi3
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

by:delphi3
ID: 6373233
Mike,

I know that this is like an adventure that has to be mountain climbing, but with no vision.
First, I tried removing the (V,V,V,V) and the message I got is

[Error] GetWebBrowserUnit1.pas(54): Not enough actual parameters
It wants all 4 V's in a row.

Next: A look on the palet shows only 1 icon available that of webBrowser_V1 and when it is placed
on the form then webBrowser_V1 is the one.

At some point in this game I did have 2 icons on the pallet that BOTH looked that same. Some how
one of them disappeared. So I did look in the Component pallet and under import ActiveX
Microsoft Internet Active controls (version 1.1) It Shows 2 Class names:
 TwebBrowser_V1
 TwebBrowser

then  with install button pushed it says that  TwebBrowser_V1  is already installed.

Mike, I cannot the  TwebBrowser to be on the pallet

Delphi3
0
 
LVL 6

Accepted Solution

by:
edey earned 200 total points
ID: 6373704
Hmmm, Does your system curently have IE 5+ installed (and working)? Can you reinstall the activeX wrappers if you uninstall TWebBrowser_V1 first?

GL
Mike
0
 
LVL 4

Author Comment

by:delphi3
ID: 6382413
Mike,
There is no practical purpose to continue with this. This ActiveX unit operation is poor,
in my estimation.

1. I have, if this is what you are asking for, Microsoft Windows 2000, 5.00.2195 Service pack 1
2. I choose not to trash it all to recover TWebBrowser. I have no assurance that it will work and
the amount of work necessary to get my D4 package back up with the special inserts.

3. So now I have parsed the operation of Click1, Now Click1 is to just get the web page and
Click2 is to get the rest of it. I think that this arrangement works OK for one as shown below.
But I am not happy with the results.



procedure TForm1.Button1Click(Sender: TObject);
var
  V : OleVariant;
begin
webBrowser_V11.Navigate(Edit1.Text, V, V, V, V);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  Doc,  Bod: OleVariant;
begin
   while webBrowser_V11.Busy do
     Application.ProcessMessages;
  Doc := webBrowser_V11.Document;
  Bod := Doc.Body;

  Memo1.Text := Bod.InnerHTML;
  Memo1.Lines.SaveToFile(ExtractFilePath(Application.exeName) + Edit2.Text);

  Memo1.Clear;

  Memo1.Text := Bod.InnerText;
  Memo1.Lines.SaveToFile(ExtractFilePath(Application.exeName) + Edit3.Text);
end;

 I don't know who really should get the points for the help. But anyway I will give them to
 Mike and a 'B'  grade for the effort.

Thanks All for your efforts.

Delphi3
0
 
LVL 4

Author Comment

by:delphi3
ID: 6392774
Hi Mike,
I did a uninstall D4 and then re installed it  again.
Now I have no TWebBrowser. Maybe I never had it in the first place.


But that is OK,
I guess,
Delphi3
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6907062
Please update the expert here who have so willingly stepped in to help you, since much time has passed since your last comments, and Email notifications may not have been generated to the participating experts here due to some problems at that time.  If you've been helped, accept the respective question by that expert to grade and close it.

Somewhat off-topic, but important.

****************************** ALERT********************************
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015  
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0

Thought you'd appreciate knowing this.
":0)
Asta
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6907066
By the way, this question still sits in the OPEN QUESTION QUEUE, you may need Moderator help to determine why.
0
 
LVL 4

Author Comment

by:delphi3
ID: 6907135
astaec,

I have accepted the answer and awarded the points as noted above. Then why  is it standing so naked that you noticed it?
I think that all this happened when the EE system was in disarray.
If the points have not been awarded then I award them(50).  If the grade has not been given then It should have been a 'B'.
I want to get this Q to have it's clothes on. :) a closure!!!

Delphi3
0
 
LVL 4

Author Comment

by:delphi3
ID: 6907470
astaec,

I have accepted the answer and awarded the points as noted above. Then why  is it standing so naked that you noticed it?
I think that all this happened when the EE system was in disarray.
If the points have not been awarded then I award them(50).  If the grade has not been given then It should have been a 'B'.
I want to get this Q to have it's clothes on. :) a closure!!!

Delphi3
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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