|I looked at the source from the yellow pages and, like much of the html out there, it suffers from a lack of line-structure (sanely placed car.rets and line feeds). This fact, plus the abundance of special characters harmful to batch, pretty much precludes a pure batch solution. I made a vbscript to "fix" the line-feed problem since it's such a common affliction. You can use WGET to obtain the html, fix the line-feeds using crlf.vbs, then find the phone:|
:: ---- begin batchscript YP.bat
@echo off & setlocal
rem this gets the html, into file YP, but the url still needs to be built from your source material
wget -O yp "http://www.yellowpages.com/whitepages/address?street=2427+vallejo+street&zip=san+francisco&state=CA"
rem next line puts a crlf in front of each "<" in the file.
cscript /nologo crlf.vbs yp
rem FINDSTR has to be used due to the dbl quotes which FIND can't deal with.
rem note that we could also put a replacement of dbl to sgl quotes into the vbscript,
rem but I wanted to keep the crlf.vbs minimal.
for /f "tokens=2 delims=>" %%a in ('findstr /i "class=\"phone\"" yp') do echo %%a
::---- end batchscript
'---- begin vbscript CRLF.vbs
'---- end vbscript
This solution is not "turn-key". You need to handle getting the data from the spreadsheet and building the wget statement. I have forgotten most of what little I knew about accessing the excel object, but you can always save the spreadsheet as text and use batch to work from that. If you go that route, and want me to help build the wget statement, just post or pmail me with a sample of the exported text. WGET can be found at sourceforge: http://gnuwin32.sourceforge.net/pac...
or just google "WGET WINDOWS". Then there's getting the phone back into the spreadsheet if that's what you intend to do.
ps: oops, didn't see your last statement before I posted this.
pps: oops again, mixed up city with zip. fixed in post. Imacros looks interesting, so thanks for that lead, and good luck.
message edited by nbrane