AUTORUN;
var s: String;
var tab: Tstringlist;tab:=Tstringlist.create;
var i: integer;
var ajoutes:integer;
var description : string;
var email : string;
var name : string;
var website : string;
var phone : string;
var fax : string;
createTable('description','email','name','website','phone','fax');
showmessage('Ce script a pour but de vous montrer l''aspiration des données à partir des superPages US');
navigate('http://www.superpages.com');
showmessage('Choisissez votre catégorie, votre provence et naviguez jusqu''aux premiers résultats');
repeat;
sleep(10);
s:=trim(getText('TD(1)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR(2)/TBODY(0)/TABLE(0)/TD(0)/TR(4)/TBODY(0)/TABLE(0)/TD(2)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR(0)/TBODY(0)/TABLE(1)/BASEFONT(0)/BODY(0)/BASE(0)/HEAD(0)/HTML(0)/',1));
until s<>'';
showDatabase;
repeat;
ajoutes:=recordCount;
for i:=50 downto 1 do begin;
s:='TD(1)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR('+inttostr(i)+')/TBODY(0)/TABLE(0)/TD(0)/TR(4)/TBODY(0)/TABLE(0)/TD(2)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR(0)/TBODY(0)/TABLE(1)/BASEFONT(0)/BODY(0)/BASE(0)/HEAD(0)/HTML(0)/';
tab.text:=getText(s,1);
s:=tab.text;
if (tab.count)>2 then begin;
name:=tab[0];
description:=tab[1];
email:=extractEmails(tab.text);
website:=extractUrlsfromString(tab.text);
phone:=ExtractPhones(tab.text);
fax:=extractFaxs(tab.text);
end;
end;
InsertData(description,email,name,website,phone,fax);
s:=getBrowserUrl(1);
clickForm('IMG(0)/A(0)/SPAN(0)/TD(0)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR(1)/TBODY(0)/TABLE(0)/TD(2)/TR(0)/TBODY(0)/TABLE(0)/TD(0)/TR(0)/TBODY(0)/TABLE(1)/BASEFONT(0)/BODY(0)/BASE(0)/HEAD(0)/HTML(0)/',1);
s:=getBrowserUrl(1);
ajoutes:=recordcount-ajoutes;
until (ajoutes=0);