unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, shellapi, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 =
class(TForm)
wb: TWebBrowser;
plz_1: TEdit;
ort_1: TEdit;
Strasse_1: TEdit;
plz: TEdit;
ort: TEdit;
strasse: TEdit;
Button2: TButton;
Memo1: TMemo;
Memo2: TMemo;
kilometer: TEdit;
Button3: TButton;
Button4: TButton;
IdHTTP1: TIdHTTP;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
wb.Navigate('
http://maps.google.de/maps?f=d&source=s_d&saddr=' + plz_1.text + '
' + ort_1.text + '
' + Strasse_1.text + '
&daddr=' + plz.text + '
' + ort.text + '
' + Strasse.text);
//+'&ie=UTF8&z=8'
end;
procedure TForm1.Button2Click(Sender: TObject);
var
x1, x2: Integer;
s:
string;
i: integer;
begin
for i := 0
to Memo1.Lines.Count - 1
do
begin
s := Memo1.Lines[i];
x1 := System.Pos('
<DIV>[B]', s);
x2 := System.Pos('
km[/B] – ca.', s);
if ((x1 > 0)
and (x2 > 0))
then
begin
System.Delete(s, x1, x2 - x1 - 9);
Memo2.text := s;
memo2.text := Stringreplace(memo2.text, '
', '
', [rfReplaceAll]);
memo2.text := Stringreplace(memo2.text, '
[/B] ', '
', [rfReplaceAll]);
memo2.text := Stringreplace(memo2.text, '
[B]', '
', [rfReplaceAll]);
memo2.text := Stringreplace(memo2.text, '
[/B]</DIV></DIV>', '
', [rfReplaceAll]);
kilometer.text := memo2.text;
end;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
DOM: variant;
wort, wort2:
string;
i: integer;
begin
wort := '
ist unbekannt.';
wort2 := '
Meinten Sie';
DOM := WB.Document;
if Wb.LocationURL <> '
'
then begin
memo1.text :=
DOM.Body.Innerhtml;
for i := 0
to memo1.lines.count - 1
do
if pos(wort, memo1.lines.strings[i]) <> 0
then begin
Showmessage('
Der Ort ' + Strasse.text + '
, ' + plz.text + '
' + ort.text + '
' + wort);
end
else
if pos(wort2, memo1.lines.strings[i]) <> 0
then begin
if MessageBox(
Handle, PChar('
Überprüfen Sie bitte nochmal die Adresse, ' + #13#10 + '
wollen Sie die Adresse online bei "Google Maps" überprüfen lassen?'), PChar('
Information'), $00000021) = IDOK
then
begin
ShellExecute(
Handle, '
open', pChar('
http://maps.google.de/maps?f=d&output=html&saddr=' + Strasse_1.text + '
+%2C+' + plz_1.text + '
+' + ort_1.text + '
&daddr=' + Strasse.text + '
+%2C+' + plz.text + '
+' + ort.text),
nil,
nil, SW_SHOW);
end
else
ShowMessage('
No page available!');
end;
end;
end;
end.