User:Cmsjustin/tousdvalues.bat

title USD:Init set BufferOutput=c:\temp\tousdvalues_buffer set BufferTemp=c:\temp\tousdvalues_temp set CountThis=0 echo ^>%BufferOutput% echo >>%BufferOutput% echo ^^This is a list of direct currency conversions from international currencies to American Dollars, used by Template:ToUSD. A script is being run by User:Cmsjustin to automatically update these values. Please see User:Cmsjustin for more information.^>>%BufferOutput%

type %BufferOutput% | find /v /i "error">c:\temp\tousdvalues.txt del %BufferOutput% /F /Q del %BufferTemp% /F /Q echo %date% %time% EST title USD:Done notepad.exe c:\temp\tousdvalues.txt goto :EOF


 * Main

set /a CountThis+=1 set /a CountPercent=%CountThis%00/%CountTotal% title USD:%CountPercent%%% set CountryCodeDesc=%1 set CountryCode=%CountryCodeDesc:~1,3% set CountryDesc="%CountryCodeDesc:~5,-1%" curl -A "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.0.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" --url "http://www.google.com/search?complete=1&hl=en&q=%CountryCode%+in+USD" -o curloutput.html for /F "tokens=1 delims=" %%a in ('pscrape -u"file://c:/temp/curloutput.html" -e"1>1 (.*) U.S. dollars"') do echo %%a END >%BufferTemp% for /F "tokens=1 delims=" %%a in ('pscrape -u"file://c:/temp/tousdvalues_temp" -e"= (.*) END"') do set ResultUSD=%%a set ResultUSD=%ResultUSD%000000000000 echo ^| %CountryCode%=%ResultUSD:~0,14% 	^>>%BufferOutput% exit /b