1.

Solve : Reading webpages through batch??

Answer»

Hi all!

I was wondering if it's possible to make a batch file that connects to the internet and looks at a web page, and if it sees a certain trigger word (E.g: It sees the word "mudcake")it would execute an action.

Thanks in Advance,

KamakQuote

was wondering if it's possible to make a batch file that connects to the internet and looks at a web page, and if it sees a certain trigger word (E.g: It sees the word "mudcake")it would execute an action

Only if the batch file launches a WINDOWS script. Most of the script languages provide for interaction with the web. Batch code not so much (actually not at all)

VBScript and Jscript come installed with Windows. Perl, PHP, Python, and REXX are ALSO tools you can use, however each must be downloaded. (all are free).

Quote from: Sidewinder on June 24, 2008, 05:39:07 AM
Quote
was wondering if it's possible to make a batch file that connects to the internet and looks at a web page, and if it sees a certain trigger word (E.g: It sees the word "mudcake")it would execute an action

Only if the batch file launches a Windows script. Most of the script languages provide for interaction with the web. Batch code not so much (actually not at all)

VBScript and Jscript come installed with Windows. Perl, PHP, Python, and REXX are also tools you can use, however each must be downloaded. (all are free).



Thanks for the fast reply Sidewinder

Do you know which of those languages would be simplest and most conveniant?My personal favorite is REXX. It has only 20 odd instructions to learn and is darned near idiot proof As mentioned it does require a download and install. For convenience, VBScript comes already installed with Windows.

This site has many tools, articles, and sample scripts to help you out.

This little snippet will give you an idea how your request looks in VBScript:

Code: [Select]Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "http://www.yahoo.com/"
Do While objie.Busy
WSCRIPT.Sleep 500
Loop

Set ieRange = objIE.Document.Body.createTextRange
If ieRange.FindText("Mudcake", 0, 2) = True Then
MsgBox("Mudcake Found")
End If
objIe.Quit

The Yahoo ADDRESS is an example. Any address can be used.

Quote from: Sidewinder on June 24, 2008, 06:31:31 AM
My personal favorite is REXX. It has only 20 odd instructions to learn and is darned near idiot proof As mentioned it does require a download and install. For convenience, VBScript comes already installed with Windows.

This site has many tools, articles, and sample scripts to help you out.

This little snippet will give you an idea how your request looks in VBScript:

Code: [Select]Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "http://www.yahoo.com/"
Do While objie.Busy
WScript.Sleep 500
Loop

Set ieRange = objIE.Document.Body.createTextRange
If ieRange.FindText("Mudcake", 0, 2) = True Then
MsgBox("Mudcake Found")
End If
objIe.Quit

The Yahoo address is an example. Any address can be used.



Thank you so much again Sidewinder, i only have 1 last question.

How do i execute programs in VBscript?One way is to type the scriptname at the command prompt, much like a batch file. The vbs extension was registered when you installed Windows. Another is to use a specific script host: wscript scriptname.vbs or cscript scriptname.vbs either at the command prompt or the Windows Run box.

If you really want to impress your friends, you can write scripts in WSF files where you can use multiple languages in a single script and you can create multiple scripts within a single file.

Happy Coding.



Discussion

No Comment Found