program InputGenes; // Reads an input CSV file containing a list of genes // extracts the Conserved and Nonconserved results to // an html file. const InputFile = 'C:\InputGenes.csv'; OutputFile = 'C:\OutputGenes.htm'; var nIndex : integer; bSearch : boolean; procedure OnDocumentComplete(URL : string); begin // move on to the next gene if current one does not exist if IsPartOf('http://www.targetscan.org/cgi-bin/targetscan/targetscan.cgi?', URL) and IsPartOf('No matches were found', GetHtmlBody) then begin bSearch := False; Writefl('
'); Writefl('
No matches were found for '+MatrixGetVal(nIndex, 1)+'
'); Writefl(''); GotoURL('http://www.targetscan.org/'); end else if IsPartOf('http://www.targetscan.org/cgi-bin/targetscan/view_gene.cgi?', URL) then begin Writefl(''+MatrixGetVal(nIndex, 1)+'
'); Writefl('Conserved
'); Writefl(GetTableAttribute(3, 'outerHTML')); Writefl('Nonconserved
'); Writefl(GetTableAttribute(4, 'outerHTML')); GotoURL('http://www.targetscan.org'); bSearch := False; end else if IsPartOf('http://www.targetscan.org/', URL) and not(bSearch) then begin if (nIndex < MatrixMaxRow) then begin nIndex := nIndex + 1; Fill('gid', MatrixGetVal(nIndex, 1)); ClickButtonValue('Submit'); bSearch := True; end else begin ShowMessage('Script Completed!'); CloseFile; NewbieScriptEnd; end; end; end; begin nIndex := 0; bSearch := False; DeleteFile(OutputFile); MatrixReadFile(InputFile); Rewrite(OutputFile); WaitForWindowKeyPress('Internet Explorer Script Error', 'ENTER', 30000); Navigate('http://www.targetscan.org'); end.