stenioc1 Posted March 20, 2014 Posted March 20, 2014 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.
somdcomputerguy Posted March 20, 2014 Posted March 20, 2014 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.
Solution Malkey Posted March 20, 2014 Solution Posted March 20, 2014 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now