AUTORUN;
var PIName:string;
var PIEmail:string;
var PITitle:string;
var ProjectTitle:string;
var Abstract:string;
var Thesaurus_Terms_temp:string;
var Thesaurus_Terms:string;
var Institution:string;
var Fiscal_Year: string;
var Department:string;
var projectstart,projectend:string;
var s:string;
var links:string;
var i:integer;
var ts: Tstringlist;ts:=Tstringlist.create;
BlockJava(true,1);
BlockSounds(true,1);
BlockActiveX(true,1);
BlockPopups(true,1);
navigate('http://crisp.cit.nih.gov/crisp/crisp_query.generate_screen',1);
showmessage('Naviguez sur la page jusqu''à apparition des résultats');
repeat;
sleep(10);
until ( pos('crisp_lib.query',getBrowserUrl(1))>0);
wait_browser(1);
links:=extracturlsfrombrowser(1);
ts.commatext:=links;
println(ts.count);
createTable('PIName','PIEmail','PITitle','ProjectTitle','Abstract','Thesaurus_Terms','Institution','Fiscal_Year','Department','ProjectSTart','ProjectEnd');
DataBaseSize(2048);
newbrowser(2);
for i:=2 to ts.count-1 do begin;
navigate(ts[i],2);
PIName:=getText('TD(0)/TR(3)/TBODY(0)/TABLE(0)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
PIEmail:=getText('A(0)/TD(0)/TR(2)/TBODY(0)/TABLE(0)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
PITitle:=getText('TD(0)/TR(1)/TBODY(0)/TABLE(0)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
ProjectTitle:=getText('TD(0)/TR(0)/TBODY(0)/TABLE(0)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
Abstract:=getText('P(2)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
Abstract:=Trim(Abstract);
Thesaurus_Terms_temp:=getText('P(1)/EM(0)/H2(0)/BLOCKQUOTE(0)/BODY(0)/HTML(0)/',2);
i:=1;
Thesaurus_Terms:=trim(parsetag(Thesaurus_Terms_temp,'Thesaurus Terms:','Institution:',i));
ReplaceNL(Thesaurus_Terms,'/');
println(Thesaurus_Terms);
i:=1;
Institution:=trim(parsetag(Thesaurus_Terms_temp,'Institution:','Fiscal Year:',i));
ReplaceNL(Institution,'/');
i:=1;
Fiscal_Year:=trim(parsetag(Thesaurus_Terms_temp,'Fiscal Year:','Department',i));
i:=1;
Department:=trim(parsetag(Thesaurus_Terms_temp,'Department:','Project',i));
i:=1;
projectstart:=trim(parsetag(Thesaurus_Terms_temp,'Start:','Project',i));
i:=1;
projectend:=trim(parsetag(Thesaurus_Terms_temp,'End:','ICD',i));
InsertData(PIName,PIEmail,PITitle,ProjectTitle,Abstract,Thesaurus_Terms,Institution,Fiscal_Year,Department,projectstart,projectend);
end;
exportDataToExcel;