// This script prompts for the name of the company and downloads // all 10-Q Forms (Quarterly and Transition Reports under Section // 13 or 15(d) of the Securities Exchange Act) // Author: Jay Alba program SECFiling; const sPath = 'c:\Temp\'; var bFound : boolean; nIndex : integer; CompanyStr : string; URLContaining10Q : string; procedure OnDocumentComplete(URL : string); begin if IsPartOf('http://www.sec.gov/edgar/searchedgar/companysearch.html', URL) then begin Fill('company', CompanyStr); ClickButton(''); end; if IsPartOf('http://www.sec.gov/cgi-bin/browse-edgar?company=', URL) then begin // we only want to retrieve all 10-Qs Forms Fill('type', '10-Q'); // clicks button by using Caption if button does not have a name ClickButtonUsingCaption('Retrieve Filings'); end; if IsPartOf('http://www.sec.gov/cgi-bin/browse-edgar?type=10-Q', URL) then begin // save URL containing list of 10-Qs, so that we can jump back to // it over and over again to get all 10-Qs URLContaining10Q := URL; // use function below if there are multiple hyperlinks on webpage // and you would like to go thru all of them; Newbie only clicks 1 // but if brought to the same page again using URLContaining10Q, it // remembers to click one that hasn't been clicked yet ClickMultiHyperLink('10-Q'); end; if IsPartOf('http://www.sec.gov/Archives/edgar/data/', URL) and not(bFound) then begin bFound := ClickPartialHyperLink('Document 1 - file:'); // it might returns 10-Q right away; if not(bFound) then begin GetURLFile(sPath+CompanyStr+IntToStr(nIndex), URL); // increment filename index nIndex := nIndex+1; // initialize back to not found and start with next 10-Q bFound := False; // jump back to the 10-Q list using URLContaining10Q GoToURL(URLContaining10Q); end; end else if (bFound) then begin GetURLFile(sPath+CompanyStr+IntToStr(nIndex), URL); // increment filename index nIndex := nIndex+1; // initialize back to not found and start with next 10-Q bFound := False; // jump back to the 10-Q list using URLContaining10Q GoToURL(URLContaining10Q); end; end; begin nIndex := 1; bFound := False; // prompt user for company name CompanyStr := Readln('Enter Company Name:'); // always start off by using Navigate as it initializes internal variables Navigate('http://www.sec.gov/edgar/searchedgar/companysearch.html'); end.