Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Reading webpages through batch?  (Read 2762 times)

0 Members and 1 Guest are viewing this topic.

kamak

    Topic Starter


    Rookie

    Reading webpages through batch?
    « on: June 24, 2008, 05:01:06 AM »
    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,

    Kamak

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Reading webpages through batch?
    « Reply #1 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).

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    kamak

      Topic Starter


      Rookie

      Re: Reading webpages through batch?
      « Reply #2 on: June 24, 2008, 05:41:37 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).

       8)

      Thanks for the fast reply Sidewinder :)

      Do you know which of those languages would be simplest and most conveniant?

      Sidewinder



        Guru

        Thanked: 139
      • Experience: Familiar
      • OS: Windows 10
      Re: Reading webpages through batch?
      « Reply #3 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 ;D 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.

       8)
      The true sign of intelligence is not knowledge but imagination.

      -- Albert Einstein

      kamak

        Topic Starter


        Rookie

        Re: Reading webpages through batch?
        « Reply #4 on: June 24, 2008, 07:06:40 AM »
        My personal favorite is REXX. It has only 20 odd instructions to learn and is darned near idiot proof ;D 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.

         8)

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

        How do i execute programs in VBscript?

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: Reading webpages through batch?
        « Reply #5 on: June 24, 2008, 07:53:22 AM »
        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.  8)

        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein