program NewbieScript; { Basic script to search eBay for a list of books defined in c:\ebaylist.txt and output the search result per file as follows c:\ebay.xls } const ExcelFile = 'c:\Ebay.xls'; MyList = 'c:\ebaylist.txt'; var sRow,sCell : string; sSearchStr : string; nCount : integer; I, J : integer; { Process events here } procedure OnDocumentComplete(URL : string); begin if IsPartOf('http://books.ebay.com/', URL) then begin // assign search string to title field Fill('satitle', sSearchStr); // search button does not have a name, no way to reference it, just press enter SendKeyPress('Enter'); end; if IsPartOf('http://search.ebay.com/search/search.dll?', URL) then begin // get all results at html table 9, only first 10 rows, cells 3-6 For I := 1 to 10 do begin // always clear sRow for each record sRow := ''; For J := 3 to 6 do begin // get cell data and compose a row of a record sCell := GetTableCell(9, I, J); sRow := sRow + ' ' + sCell; end; // append extracted row to excel file TextAppendToFile(ExcelFile, sRow); end; // read next search keyword from file if not(EndOfFile) then begin Readfl(sSearchStr); GotoURL('http://books.ebay.com/'); end else CloseFile; end; end; { This is the main program body. } begin nCount := 1; Reset(MyList); if not(EndOfFile) then begin Readfl(sSearchStr); Navigate('http://books.ebay.com/'); end; end.