Jump to content
Sign in to follow this  
dinodod

_StringBetween not working with _IEBodyReadHTML

Recommended Posts

dinodod

My example is using Google's web site (www.google.com)

I can't understand why a valid search returns nothing. Does the _IEBodyReadHTML put teh data into a string expression? How can I use _IEBodyReadHTML with _StringBetween?

For what I am trying to do, I do need to be able to search the HTML version of the web sites, not just the text.

In the example below, $Shtml shows me the HTML of the page but $test1 doesn't seem to read it???

$oIE = _IECreateEmbedded ()
$tab = GUICtrlCreateTab(10, 10, $TabWidth, $TabHeight)
   ... (Tabs)
GUICtrlCreateTabItem("")   ; end tabitem definition
GUISetState()     ;Show GUI



_IENavigate ($oIE, "http://www.google.com")
$sHTML = _IEBodyReadHTML ($oIE)
    $test1 = _StringBetween($sHTML, '<title', '/title>')
    msgbox(0,"",$test1 & $sHTML)

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites
PsaltyDS

My example is using Google's web site (www.google.com)

I can't understand why a valid search returns nothing. Does the _IEBodyReadHTML put teh data into a string expression? How can I use _IEBodyReadHTML with _StringBetween?

For what I am trying to do, I do need to be able to search the HTML version of the web sites, not just the text.

In the example below, $Shtml shows me the HTML of the page but $test1 doesn't seem to read it???

$oIE = _IECreateEmbedded ()
$tab = GUICtrlCreateTab(10, 10, $TabWidth, $TabHeight)
   ... (Tabs)
GUICtrlCreateTabItem("")  ; end tabitem definition
GUISetState()    ;Show GUI

_IENavigate ($oIE, "http://www.google.com")
$sHTML = _IEBodyReadHTML ($oIE)
    $test1 = _StringBetween($sHTML, '<title', '/title>')
    msgbox(0,"",$test1 & $sHTML)
Two problems:

1. The <title> tag is in DOC HTML, not the BODY HTML, so you have to use _IEDocReadHTML() vice _IEBodyReadHTML()

2. On success, _StringBetween() returns an array.

#include <IE.au3>
#include <String.au3>

$oIE = _IECreate()

_IENavigate ($oIE, "http://www.google.com")

$sHTML = _IEDocReadHTML($oIE)
$test1 = _StringBetween($sHTML, '<title', '/title>')
msgbox(0,"",$test1[0])

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
bogQ

can this help?

#include <IE.au3>
#include <String.au3>
#include <array.au3>
$oIE = _IECreate ("http://www.autoitscript.com/autoit3/")
$sHTML = _IEBodyReadHTML ($oIE)
MsgBox(0,"",$sHTML)
$test2 = _StringBetween($sHTML, '(', ')')
_ArrayDisplay($test2, 'StringRegExp Search')

that "Venerable Old Bird" whas faster :/

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
enaiman

It works but IMO - you've made 2 mistakes:

1. there is no '<title', '/title>' in the return of _IEBodyReadHTML

Return Value

Success: Returns HTML included in the <body> of the document

2. _StringBetween returns an array

Return Value

Success: A 0 based $array[0] contains the first found string.

This example works:

#include <IE.au3>
#Include <String.au3>
#Include <array.au3>

$oIE = _IECreate ("")

_IENavigate ($oIE, "http://www.google.com", 1)
$sHTML = _IEBodyReadHTML ($oIE)
    $test1 = _StringBetween($sHTML, '<DIV', '</DIV>')
_ArrayDisplay($test1)
msgbox(0,"",$sHTML)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
dinodod

Thanks for the replies. I will review all the responses tonight and update my code.

I wasn't aware of the array thus the reason I was going nuts :P

Thanks to all!

:P


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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  

×