Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
Delphi 10.1 Berlin Architect
|
AW: Thunderbird
27. Feb 2012, 15:53
OK friends, here's my code that works.
The file is loaded Memo1 abook.mab
Memo2 The resulting list is then e-mail addresses
Delphi-Quellcode:
procedure TForm1.ExtractAdress;
var
pth,s1,s2:string;
c1,c2,c3:integer;
c,x,y:integer;
begin
pth := 'C:\Users\<username>\AppData\Roaming\Thunderbird\Profiles\<profile_name>\abook.mab';
s1 := '@';
s2:= '<';
memo1.Lines.LoadFromFile(pth);
for y := 23 downto 0 do
begin
memo1.Lines.Delete(0);
end;
for c1 := 0 to Memo1.Lines.Count - 1 do
begin
memo1.lines[c1]:= (StringReplace(memo1.lines[c1],'=','='+#13#10,[rfReplaceAll]));
end;
for c2 := 0 to Memo1.Lines.Count - 1 do
begin
memo1.lines[c2]:= (StringReplace(memo1.lines[c2],')',''#13#10+'',[rfReplaceAll]));
end;
for c3 := 0 to Memo1.Lines.Count - 1 do
begin
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$${1{@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$$}1}@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$${3{@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$$}3}@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$${4{@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$$}4}@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$${5{@','',[rfReplaceAll]));
memo1.lines[c3]:= (StringReplace(memo1.lines[c3],'@$$}5}@','',[rfReplaceAll]));
end;
for c := Memo1.Lines.Count - 1 downto 0 do
begin
if AnsiPos(s1, Memo1.Lines[c]) <> 0 then
Memo2.Lines.Add(Memo1.Lines[c]);
end;
for x := Memo2.Lines.Count - 1 downto 0 do
begin
if AnsiPos(s2, Memo2.Lines[x]) <> 0 then
Memo2.Lines.Delete(x);
end;
end;
Daniel
Geändert von danten (27. Feb 2012 um 16:12 Uhr)
|