Vincentg
asked on
Extract from file...
Hello,
I need to extract the title from an HTML document on my local drive.
How can i read the html code and put everything between <title> and </title> in a string.?
Thanks,
Vincent
I need to extract the title from an HTML document on my local drive.
How can i read the html code and put everything between <title> and </title> in a string.?
Thanks,
Vincent
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot, it works for me :)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw;
type
TForm1 = class(TForm)
w: TWebBrowser;
Edit1: TEdit;
Button1: TButton;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure wDocumentComplete(Sender: TObject; const pDisp: IDispatch;
var URL: OleVariant);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
begin
w.Navigate(edit2.Text);
end;
procedure TForm1.wDocumentComplete(S
var URL: OleVariant);
var
doc:variant;
begin
doc:=w.Document;
edit1.Text:=doc.title;
end;
end.