Link to home
Start Free TrialLog in
Avatar of Vincentg
VincentgFlag for Netherlands

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
ASKER CERTIFIED SOLUTION
Avatar of Motaz
Motaz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of f15iaf
f15iaf

Another solution:

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: TObject);
begin
        w.Navigate(edit2.Text);        
end;

procedure TForm1.wDocumentComplete(Sender: TObject; const pDisp: IDispatch;
  var URL: OleVariant);
var
        doc:variant;
begin
        doc:=w.Document;
        edit1.Text:=doc.title;
end;

end.
Avatar of Vincentg

ASKER

Thanks a lot, it works for me :)