Jump to content

Search HTML code for string


Recommended Posts

I have a script that opens web addresses listed in a control record. And I need to search each page for a string, and if the string exists, to print that page, then move on to the next ip address in the control record.

What function searches the HTML code for a string? That's all I need to know.

Many thanks.

Spomgey

Link to comment
Share on other sites

_IEBodyReadText (see also _IEReadHTML) will return just the text in a page (using IE) so that you can use String functions to search it. _INetGetSource will return you HTML without using a browser.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

e.g. This script will let you know the current weather in London using HTML source from a web site.

#include <INet.au3>
#include <array.au3>
#include <String.au3>

$html = _INetGetSource('http://uk.weather.com/weather/local/UKXX0085')

$sStart = "<B>Feels Like<BR>"
$sEnd = "&deg"
$Array1 = _StringBetween ($html, $sStart, $sEnd)
_ArrayToClip ($Array1)
$result = (ClipGet())

MsgBox(0, "London feels like:", $result & " Degrees Centigrade")
Edited by saldous
Link to comment
Share on other sites

_IEBodyReadText (see also _IEReadHTML) will return just the text in a page (using IE) so that you can use String functions to search it. _INetGetSource will return you HTML without using a browser.

Dale

Thanks! When you say IE, you mean IE.au3? Or, just Internet Explorer?
Link to comment
Share on other sites

e.g. This script will let you know the current weather in London using HTML source from a web site.

#include <INet.au3>
#include <array.au3>
#include <String.au3>

$html = _INetGetSource('http://uk.weather.com/weather/local/UKXX0085')

$sStart = "<B>Feels Like<BR>"
$sEnd = "&deg"
$Array1 = _StringBetween ($html, $sStart, $sEnd)
_ArrayToClip ($Array1)
$result = (ClipGet())

MsgBox(0, "London feels like:", $result & " Degrees Centigrade")
Thanks for the great example!

Spongey

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...