Sign in to follow this  
Followers 0
MirnesC2

reading HTML

9 posts in this topic

#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEDocReadHTML ($oIE)
MsgBox(0, "Document Source", $sHTML)

$sHTML shows the full source code of a webpage but I don't need the whole code. I want to check for a specific line of text or a specific word.

I want it to find this line.

<input type="text" size="16" name="UserName" onfocus="focus_username(this)" value="" />

How can I go about doing this?

Share this post


Link to post
Share on other sites



Check StringRegExp()

Share this post


Link to post
Share on other sites

I looked at it but I didn't understand it. Maybe an easier example?

Share this post


Link to post
Share on other sites

#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEDocReadHTML ($oIE)
MsgBox(0, "Document Source", $sHTML)

$sHTML shows the full source code of a webpage but I don't need the whole code. I want to check for a specific line of text or a specific word.

I want it to find this line.

<input type="text" size="16" name="UserName" onfocus="focus_username(this)" value="" />

How can I go about doing this?

Which bits of the example string you gave are fixed and which bits vary and which bit you want to extract?

If you just want UserName then _StringBetween would be the simplest way perhaps.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I figured it out. Thanks for the help!

$sHTML = _IEDocReadHTML ($oIE)
$check = StringRegExp($sHTML,"UserName",0)

Returns 0 or 1

0 = not found

1 = found

Although I could use help on closing the IE form now. I searched the help files for IE close, delete, and destroy but nothing came up.

Edited by MirnesC2

Share this post


Link to post
Share on other sites

_IEQuit() is your friend!

Share this post


Link to post
Share on other sites

You missed one word in your search >> Quit

_IEQuit()


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Lol!, thanks for the help. +REP for you guys xD

Edited by MirnesC2

Share this post


Link to post
Share on other sites

$oUsername = _IEGetObjByName($oIE, "username")

ConsoleWrite( _IEPropertyGet($oUsername, "outerhtml") & @CRLF)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0