Bat file to find a phrase on a website
Moderator: DosItHelp
Bat file to find a phrase on a website
Hello community,
Here is what I am needing help with:
I want to create a batch file that looks at an open website in Internet Explorer (that will be left open at all times). This bat file will need to refresh the window every 15 to 60 seconds and look for a specific phrase on the website. If it finds that phrase it will open a pop up window that will notify the user (me) that it found that phrase.
I can't seem to be able to find anything on the subject. I hope that you guys can help me. Thank you in advance.
Here is what I am needing help with:
I want to create a batch file that looks at an open website in Internet Explorer (that will be left open at all times). This bat file will need to refresh the window every 15 to 60 seconds and look for a specific phrase on the website. If it finds that phrase it will open a pop up window that will notify the user (me) that it found that phrase.
I can't seem to be able to find anything on the subject. I hope that you guys can help me. Thank you in advance.
Re: Bat file to find a phrase on a website
You can use WGET.EXE which is a free download and do that, probably.
The process would be to download the web page with WGET, pipe it through findstr to find the phrase and then alert you when it has found the phrase, probably by beeping.
What we'd need to write the batch file is the URL for the web site and the phrase to find, so that testing the batch file is feasible.
If you cannot provide the URL etc then all we can provide is the basic syntax.
The process would be to download the web page with WGET, pipe it through findstr to find the phrase and then alert you when it has found the phrase, probably by beeping.
What we'd need to write the batch file is the URL for the web site and the phrase to find, so that testing the batch file is feasible.
If you cannot provide the URL etc then all we can provide is the basic syntax.
Re: Bat file to find a phrase on a website
you can also use a vb-script instead of the wget.exe tool, to retrieve the source of the webpage
Re: Bat file to find a phrase on a website
Foxi,
I can provide the URL, but it's after I have already logged in our CRM for the place that I work for. You would have to have my login information in order to get into the site, which I can not provide due to it being a work related website. Is there a way to just put "example website here" such as craigslist or something and search for something there? I totally understand what you are saying.
ABC. I found a way to refresh the page using a VB script, but how would I look at the HTML source and find what I am looking for in there?
I can provide the URL, but it's after I have already logged in our CRM for the place that I work for. You would have to have my login information in order to get into the site, which I can not provide due to it being a work related website. Is there a way to just put "example website here" such as craigslist or something and search for something there? I totally understand what you are saying.
ABC. I found a way to refresh the page using a VB script, but how would I look at the HTML source and find what I am looking for in there?
Re: Bat file to find a phrase on a website
I don't know if VB script handles authentication, but wget does.
This is air code (untested):
This is air code (untested):
Code: Select all
@echo off
:loop
echo testing at %date% %time
del file.tmp 2>nul
"c:\Program Files\WGET\WGET.EXE" --output-document=FILE.TMP --http-user=USER --http-passwd=PASSWORD "http://website.domain.com/page/"
findstr /i "phrase" file.tmp >nul
if not errorlevel 1 (
echo [string of control G characters here - ascii 07]
echo found the phrase
pause
)
ping -n 60 localhost >nul
goto :loop
Re: Bat file to find a phrase on a website
@jemmoe, After you said Authentication, Foxidrive is the best, and the problem is not how to refresh the IE, you will have to download the webpage every 15-60 sec this is considered as a refresh.
Then you search in that html file like any other txt file,
try Foxi's Code.
Then you search in that html file like any other txt file,
try Foxi's Code.
-
- Posts: 22
- Joined: 20 Nov 2012 12:42
Re: Bat file to find a phrase on a website
hey what about using telnet? every one have one, or is so old that no one cares about it any more?
Try this:
First if using vista or 7 turn on telnet its easy... google search turn on telnet windows vista /7
then add some batch add some vbs add some magic powder and voila!
the only thing that you have to do is to sniff the header of a browser connection to that website and change in the script the:
telnet -f telrep.txt WEBSITE.changeme 80
GET OR POST BLA BLA BLA
Host: YOUR_WEBSITE_HOST
and maybe add the line that login you , this is preaty easy and simple, telnet always rock cause it can pretend that is almost any client , bowser client , telnet , ftp , irc , and others that you can remenber.
regards
Try this:
First if using vista or 7 turn on telnet its easy... google search turn on telnet windows vista /7
then add some batch add some vbs add some magic powder and voila!
Code: Select all
@echo off
:main
Rem here we will create a vbs sendkeys file to operate with telnet
echo abcode.SendKeys "title closeme" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 100 >> %temp%\hhm.vbs
echo abcode.SendKeys "mode con:cols=100 lines=1" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 100 >> %temp%\hhm.vbs
echo abcode.SendKeys "telnet -f telrep.txt WEBSITE.changeme 80" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 100 >> %temp%\hhm.vbs
echo abcode.SendKeys "GET OR POST BLA BLA BLA" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 1 >> %temp%\hhm.vbs
echo abcode.SendKeys "Host: YOUR_WEBSITE_HOST" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 1 >> %temp%\hhm.vbs
echo abcode.SendKeys "User-Agent: Mozilla/5.0 (Windows NT 6.1)" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 1 >> %temp%\hhm.vbs
echo abcode.SendKeys "Accept: */*" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 1 >> %temp%\hhm.vbs
echo abcode.SendKeys "Accept-Encoding:" >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
echo WScript.Sleep 1 >> %temp%\hhm.vbs
echo abcode.SendKeys^( "{Enter}" ^ ) >> %temp%\hhm.vbs
call %temp%\hhm.vbs
Rem here make him wait a litle to the telnet download the website
ping 127.0.0.1 -n 5 >nul
Rem then kill telnet
taskkill /im telnet.exe /f>nul
cls
Rem then it will remain an open window that the next lines will close
tasklist /v /fo csv | findstr /i "closeme">%temp%\jjy.txt
cls
for /f "tokens=2 delims=, " %%A in (%temp%\jjy.txt) do (taskkill /pid %%A /T /F)
Rem then lets find that phrase that you want
findstr /l "The Phraze or word" telrep.txt>nul
if not errorleve 1 goto abc
if errorleve 1 goto abc1
Rem Here the word was not found so he will wait 20 seconds
:abc1
ping -n 21 127.0.0.1>nul
goto main
Rem if the word was found set up your code to pop up the window etc etc
:abc
start popupwindow
pause
the only thing that you have to do is to sniff the header of a browser connection to that website and change in the script the:
telnet -f telrep.txt WEBSITE.changeme 80
GET OR POST BLA BLA BLA
Host: YOUR_WEBSITE_HOST
and maybe add the line that login you , this is preaty easy and simple, telnet always rock cause it can pretend that is almost any client , bowser client , telnet , ftp , irc , and others that you can remenber.
regards
Re: Bat file to find a phrase on a website
Any webhost that is dumb enough to have telnet open and runnin on their server won't be in business very long.
-
- Posts: 22
- Joined: 20 Nov 2012 12:42
Re: Bat file to find a phrase on a website
Squashman wrote:Any webhost that is dumb enough to have telnet open and runnin on their server won't be in business very long.
What are you talking about?
did you read the code? Do you know telnet? Have you used it for once in your life? It seem you dont. The telnet will connect to the website to port 80 making web browser requests, the host will see no diference between that requests and a browser request...its not rocket science...