Jump to content
Sign in to follow this  
stenioc1

How get one word in html

Recommended Posts

stenioc1

Hello, I've a problem (I'm newbie in AutoIT), I don't know how get one word in the html code, for example:

<span id="lblTotal" class="Bold_Text">26</span>

 I desire in the case, get a value "26", how I do it ?

Thanks.

Share this post


Link to post
Share on other sites
somdcomputerguy

You could use the _StringBetween function, like this

#include <String.au3>

$string = '<span id="lblTotal" class="Bold_Text">26</span>'
$found  = _StringBetween($string, 'class="Bold_Text">', '</span>')
MsgBox(0, '', $found[0])

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Malkey

Here are another couple of methods base on the "id".

#include <String.au3>

$string = '<span id="lblTotal" class="Bold_Text">26</span>'
$found = StringRegExpReplace($string, '(?s).*id="lblTotal"[^>]*>([^<]+)</span>.*', "\1")
MsgBox(0, '', $found)

and

#include <IE.au3>

Local $Source = '<span id="lblTotal" class="Bold_Text">26</span>'

Local $oIE = _IECreate("about:blank", 0, 0, 0, 0)
_IEBodyWriteHTML($oIE, $Source)

Local $oId = _IEGetObjById($oIE, "lblTotal")

MsgBox(0, "Results", $oId.innertext)

Share this post


Link to post
Share on other sites
stenioc1

It's working, thanks for help  :thumbsup:

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  

×